H (Hybrid) Language
∟"string" Data Type
∟What Is "string" Data Type
This section describes what is 'string' data type.
"string" data type defines how character string data objects should be constructed
and what operations are provided for them.
"string" data type should support the following features:
- "string" literals: "A", "A dog", "變量",
"1", "3.14", "10%", etc.
- "string" constructor function: string().
- "string" "get" operation function: string.get(), which returns the character of a given location.
- "string" "set" operation function: string.set(), which sets the character of a given location.
- "string" element variable expression, x[i], for getting and setting a character at a given location.
- "string" "addition" operation function: string.add(), which is an alias of string.concatenation().
- "string" "addition" operator "+", alias of string.add().
- "string" "subtraction" operation function: string.subtract(), which removes sub-strings.
- "string" "subtraction" operator "-", alias of string.subtract().
- "string" "multiplication" operation function: string.multiply(), which repeats a string.
- "string" "multiplication" operator "*", alias of string.multiply().
- "string" "division" operation function: string.divide(), which splits a string with an equal length.
- "string" "division" operator "/", alias of string.divide().
- "string" "modulo" operation function: string.remainder(), which returns the remainder of an equal-length split.
- "string" "modulo" operator "%", alias of string.remainder().
- "string" "sub-string" operation function: string.subString(), which returns a sub-string from a given location.
- "string" "find" operation function: string.find(), which finds the location of a sub-string.
- "string" "replace" operation function: string.replace(), which replaces a sub-string with a given string.
- "string" "split" operation function: string.split(), which splits a string with a given delimiter.
Table of Contents
About This Book
Introduction of H Language
Syntax
Data Types
Variables
Expressions
Statements
"boolean" Data Type
"integer" Data Type
►"string" Data Type
►What Is "string" Data Type
"string" Literals
Escape Sequences in "string" Literals
Escape Sequences for Non-Printable ASCII Characters
Escape Sequences for Unicode Characters
String Literals with Line Breaks
String Literals Continuing on Next Lines
Expression Interpolation in String Literals
String Literals with No Escape Sequences
Constructor Function: string()
string.get() - Retrieve Character from String
x[i] - Array Element Format for string.get()
string.set() - Update Character to String
x[i] - Array Element Format for string.set()
"string" "add" Operation
"string" "subtraction" Operation
"string" "multiplication" Operation
"string" "division" Operation
"string" "modulo" Operation
string.length() Function
"real" Data Type
"array" Data Type
Source Code Packages
Classes and Objects
Object Oriented Programming
Inheritance - Object Attachments
Encapsulation - Private Members
References
Full Version in PDF/ePUB