JANOS Help System: [Commands] [Topics] [Tech Support] [Printable Manual] [Search]
STRING OPERATIONS The following functions perform operations on string variables. string chr( int $val ) Returns a string of length 1 containing the character represented by the integer value $val. string ltrim( string $str [, string $character_mask ] ) Strip whitespace (or other characters) from the beginning of a string. string rtrim( string $str [, string $character_mask ] ) Strip whitespace (or other characters) from the end of a string. string trim( string $str [, string $character_mask ] ) Strip whitespace (or other characters) from both the beginning and end of a string. int strlen( string $string ) Returns the byte length of the given string. int chrlen( string $string ) Returns the character length of the given string. UTF-8 encoded characters count as 1. string strtolower( string $str ) Returns string with all alphabetic characters converted to lowercase. string strtoupper( string $str ) Returns string with all alphabetic characters converted to uppercase. string ucfirst( string $str ) Returns string with the first character of the first word converted to uppercase. string ucwords( string $str ) Returns string with the first character of each word converted to uppercase. string strval (expr) Returns a string representation for the value of the expression or variable. string substr ( string $str, int $start [, int $length] ) Returns a portion of the string specified by the start and length parameters. int strpos ( string $haystack, string $needle [, int $start] ) Returns the position in $haystack of $needle if the string occurs at or after $start. Returns -1 otherwise. int stripos ( string $haystack, string $needle [, int $start] ) Returns the position in $haystack of $needle if the string occurs at or after $start. Returns -1 otherwise. The comparison is case-independent. int strrpos ( string $haystack, string $needle [, int $start] ) Returns the last position in $haystack of $needle if the string occurs at or after $start. Returns -1 otherwise. int strripos ( string $haystack, string $needle [, int $start] ) Returns last the position in $haystack of $needle if the string occurs at or after $start. Returns -1 otherwise. The comparison is case-independent. bool startsWith( string $haystack, string $needle ) Returns TRUE if $haystack starts with the string $needle. bool endsWith( string $haystack, string $needle ) Returns TRUE if $haystack ends with the string $needle. int strcmp( string $str1, string $str2 ) Compares two strings in a binary safe manner. Returns 0 if both strings are equal. Returns a negative value (<0) if $str1 less than $str2 and a positive value (>0) if $str1 is greater than $str2. string bin2hex ( mixed $var ) Returns a String containing the hexadecimal representation of each character in $var. $var is converted to its string representation if not initially a String. string hex2bin ( string $hex ) Returns a string where the 2-byte hexadecimal representation of each character is supplied. Returns NULL is an the hexadecimal string contains an odd number of characters or any character not in the valid hexadecimal set [0-9a-fA-F]. string sprintf ( string $format [, mixed $param ] ) Returns a formatted string as defined by $format. This uses the Standard C Library format specifiers. A variable number of $param values may be supplied. string crc ( string $message ) Returns a string of length 8 containing the hexadecimal CRC32 checksum calculated for the contents of $message. string md4 ( string $message ) Returns a string of length 32 containing the hexadecimal MD4 message digest calculated for the contents of $message. string md5 ( string $message ) Returns a string of length 32 containing the hexadecimal MD5 message digest calculated for the contents of $message. string sha1 ( string $message ) Returns a string of length 40 containing the hexadecimal SHA1 message digest calculated for the contents of $message. string sha2 ( string $message ) Returns a string of length 64 containing the hexadecimal SHA256 message digest calculated for the contents of $message. int strlev( string $word1, string $word2 ) Returns the Levenshtein "distance" between two strings. This is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. This is particularly useful in detecting misspellings. SEE ALSO HELP Topics: ARRAYS, LIBRARY [/flash/manpages/scripting.hlp:899]