"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)

   a - A "string" data object
   b - An "integer" data object

   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.
   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

 About This Book

 Introduction of H Language


 Data Types




 "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


 Full Version in PDF/ePUB