String functions
The following string functions are supported. The string functions are compatible with theire PHP pendants. Note: String functions work byte orientated. UTF8 and Unicode characters can contain more than one byte. You have to be careful with fix positions when splitting a string. See also Datatypes.
Function/Arguments | Return | Description |
---|---|---|
strlen (string string) | string | Return the length of the given string in bytes. |
strcmp (string string1, string string2) | number | Compare string1 and string2. Return values: 1 = string1 > string2, -1 = string1 < string2, 0 = string1 equal to string2 |
strpos (string searchIn, string seachFor, start=0) | number | Return the position of searchFor in seachIn as number beginning from start. If searchFor was not found then false is returned. |
substr (string string, number start [, number length]) | string | Return a part of a given string beginning from start with optional length. If length is not set then the end of the string will be returned. If start is negative then it counts from the end of the string. |
strtoupper (string string) | string | Return a string in upper case. Only Ascii characters are converted to upper case. |
strtolower (string string) | string | Return a string in lower case. Only Ascii characters are converted to lower case. |
trim (string string [, string chars]) | string | Remove leading and endig spaces, line feeds and tabulators from string. If parameter chars is given then only the specified characters will be removed. The cleaned string will be returned. |
rtrim (string string [, string chars]) | string | Same as trim() but only remove ending spaces from right side of the string. |
ltrim (string string [, string chars]) | string | Same as trim() but only remove leading spaces from left side of the string. |
str_replace (mixed searchFor, mixed replaceWith, string inString ) | string | Replace one ore more parts in a string. searchFor and replaceWith can be strings or arrays. For example: str_replace (array("programming", "I"), array ("coding", "You"), "I love V1 programming.") will replace multiple parts and produce the returned string "You love V1 coding". |
explode (string delimiter, string string) | array | Return an array of splitted parts of a string. The string will be splitted in parts separated by the delimiter. |
chunk_split (string string, number length, string delimiter) | string | Split a string into parts of length separated by delimiter. This function is compatible to php chunk_split() without detault values. |
chr (number asciiNumber) | string | Return the character of a given asciiNumber. For example chr(32) will return space ' '. |
utf8_encode (string string) | string | Convert Latin2 formatted string to UTF8 and return. |
utf8_decode (string string) | string | Convert UTF8 formatted string to Latin2 and return. |
bin2hex (string string) | string | Convert binary content of a string to hexadecimal format. For examle bin2hex ("V1") will return string "5631". |
hex2bin (string string) | string | Convert hexadecimal string to binary string. For examle hex2bin ("5631") will return string "V1". |
crc32 (string string) | number | Return the CRC32 checksum of a string. |
resize (string& string, number length [,reserve=false, fillWith='']) | bool | Resize string buffer to length. If length is greater than the existing length, the complete string will be filled with zero bytes. If optional parameter reserve is true, only memory buffer will be reserved and nothing will be resized/overwritten. Optional paramer willWith can contain a string with length of 1 ascii character to fill the resized string instead of zero bytes. On success true is returned. Note: You can use this function to truncate strings, create empty strings with individual length or reserve memory buffer. |
blank (string& string, [,zeroLength=false, fillWith='']) | bool | Blank out a string with zero bytes. If optional parameter zeroLength is true, the string will also resized to length of 0 after filling. Optional paramer willWith can contain a string with length of 1 ascii character to fill the string instead of zero bytes. On success true is returned. Note: You can use this function to blank out sensitive strings in memory. |
V1 Version 0.96 - Documentation generated Sun, 05 May 2024 07:59