H (Hybrid) Language - v0.03, by Dr. Herong Yang
"string" "modulo" Operation
This section describes 'string' 'modulo' operation
The "string" "modulo" operation is provided through the string.modulo() function, which has the following syntax:
string.remainder(a, b) Parameters: a - A "string" data object b - An "integer" data object Return: Divide the given string into "b" sub-strings of equal length, except for the last sub-string in case equal division is not possible. If all sub-strings are the same length, return an empty string object. Otherwise, return the last sub-string. Errors: Throws "NotPositiveInteger" error code, if the given integer is less than 1.
The "string" "modulo" operation can be expressed in the "%" operator format:
a % b; # alias of the following function call string.remainder(a, b);
Another alias is supported too:
string.mod(a, b); # alias of the following function call string.remainder(a, b);
Examples of how to use string.remainder() operation:
"blablabla" % 3; # the result is "" "blablabl" % 3; # the result is "bl" string.remainder("blablabl",3); # the result is "bl" string.mod("blablabl",3); # the result is "bl"
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
Inheritance - Object Attachments