H (Hybrid) Language - v0.03, by Dr. Herong Yang
"string" "division" Operation
This section describes 'string' 'division' operation
The "string" "division" operation is provided through the string.divid() function, which has the following syntax:
string.divid(a, b) Parameters: a - A "string" data object b - An "integer" data object Return: Returns a new "array" data object with "b" elements set to sub-strings of the given string with equal length, except for the last element, in case equal division is not possible. Errors: Throws "NotPositiveInteger" error code, if the given integer is less than 1.
The "string" "multiplication" operation can be expressed in the "/" operator format:
a / b; # alias of the following function call string.divid(a, b);
Examples of how to use string.divid() operation:
"blablabla" / 3; # the result is ["bla", "bla", "bla"]
Design options:
1. Keep the last element in the resulting array, if it has less characters than other elements. For example,
"blablabl" / 3; # the result is ["bla", "bla", "bl"]
2. Remove the last element in the resulting array, if it has less characters than other elements. For example,
"blablabl" / 3; # the result is ["bla", "bla"]
Table of Contents
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" "subtraction" Operation
"string" "multiplication" Operation
►"string" "division" Operation
Inheritance - Object Attachments