H (Hybrid) Language
∟"string" Data Type
This chapter provides notes on 'string' Data Type in H language.
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
Takeaways:
- "string" data type defines how character string data objects should be constructed
and what operations are provided for them.
- "string" literals can be entered in double-quotes format, "..."
with escape sequences.
- Doubled-quoted string literals supports expression interpolations
in the \(...) format.
- "string" literals can be entered in single-quotes format, '...'
with no escape sequences.
- New "string" data object can be created with the constructor
function, string().
- The string.get() function returns the character from
a string at a given location.
- The string.set() function updates a given string
at a given location with a given character.
- The string.add() function returns
the concatenation of two given strings.
- The string.subtract() function returns a string
resulted from removing sub-strings from a given string.
- The string.multiply() function returns a string
resulted from repeating a given string multiple times.
- The string.modulo() function returns the remainder sub-string
after dividing a given string equally.
- The string.divid() function returns an array of sub-strings
resulted from an equal-division of a given string.
- The string.modulo() function returns the remainder sub-string
after dividing a given string equally.
- The string.length() function returns the number of characters in
a given string.
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
"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