diff --git a/functions/strings.xml b/functions/strings.xml index a50558f7e5..b7af603fde 100644 --- a/functions/strings.xml +++ b/functions/strings.xml @@ -1,5 +1,5 @@ - + String functions Strings @@ -153,37 +153,20 @@ echo addcslashes("zoo['.']", 'z..A'); chop - Remove trailing whitespace + Alias of rtrim Description - - - string chop - string str - - - Returns the argument string without trailing whitespace, - including newlines. - - <function>chop</function> example - -$trimmed = chop($line); - - + This function is an alias of rtrim. chop is different than the Perl - chop() function, which removes the last + chop() function, which removes the last character in the string. - - See also trim, ltrim, - rtrim, and chop. - @@ -1323,6 +1306,7 @@ echo "</PRE>\n"; + ltrim @@ -1334,19 +1318,96 @@ echo "</PRE>\n"; Description - string ltrim - string str + string + ltrim + + string + str + + string + charlist + This function returns a string with whitespace stripped from the - beginning of str. The whitespace - characters it currently strips are: "\n", "\r", "\t", "\v", "\0", - and a plain space. + beginning of str. + Without the second parameter, + ltrim will strip these characters: + + + + + " " (ASCII 32 + (0x20)), an ordinary space. + + + + + "\t" (ASCII 9 + (0x09)), a tab. + + + + + "\n" (ASCII 13 + (0x0D)), a newline. + + + + + "\r" (ASCII 10 + (0x0A)), a return. + + + + + "\0" (ASCII 0 + (0x00)), the NUL-byte. + + + + + "\x0B" (ASCII 11 + (0x0B)), a . + + + - See also chop, rtrim, and - trim. + You can also specify the characters you want to strip, by means + of the charlist parameter. + Simply list all characters that you want to be stripped. With + .. you can specify a range of characters. + + + Usuage example of <function>ltrim</function> + + + +]]> + + + + + + The second parameter was added in PHP 4.0.7 + + + + See also trim and rtrim. @@ -1617,32 +1678,108 @@ echo $second[1]; /* prints "another" */ + rtrim - Remove trailing whitespace. + + Strip whitespace from the end of a string + Description - string rtrim - string str + string + rtrim + + string + str + + string + charlist + - Returns the argument string without trailing whitespace, - including newlines. This is an alias for chop. - - <function>rtrim</function> example - -$trimmed = rtrim($line); - - + This function returns a string with whitespace stripped from the + end of str. + Without the second parameter, + rtrim will strip these characters: + + + + + " " (ASCII 32 + (0x20)), an ordinary space. + + + + + "\t" (ASCII 9 + (0x09)), a tab. + + + + + "\n" (ASCII 13 + (0x0D)), a newline. + + + + + "\r" (ASCII 10 + (0x0A)), a return. + + + + + "\0" (ASCII 0 + (0x00)), the NUL-byte. + + + + + "\x0B" (ASCII 11 + (0x0B)), a . + + + - See also trim, ltrim, and - rtrim. + You can also specify the characters you want to strip, by means + of the charlist parameter. + Simply list all characters that you want to be stripped. With + .. you can specify a range of characters. + + + Usuage example of <function>rtrim</function> + + + +]]> + + + + + + The second parameter was added in PHP 4.0.7 + + + + See also trim and ltrim. @@ -3398,6 +3535,7 @@ echo substr_replace($var, '', 10, -1) . "<br>\n"; + trim @@ -3409,19 +3547,96 @@ echo substr_replace($var, '', 10, -1) . "<br>\n"; Description - string trim - string str + string + trim + + string + str + + string + charlist + - This function returns a string with whitespace stripped from - the beginning and end of str. The - whitespace characters it currently strips are: "\n", "\r", "\t", - "\v", "\0", and a plain space. + This function returns a string with whitespace stripped from the + beginning and end of str. + Without the second parameter, + trim will strip these characters: + + + + + " " (ASCII 32 + (0x20)), an ordinary space. + + + + + "\t" (ASCII 9 + (0x09)), a tab. + + + + + "\n" (ASCII 13 + (0x0D)), a newline. + + + + + "\r" (ASCII 10 + (0x0A)), a return. + + + + + "\0" (ASCII 0 + (0x00)), the NUL-byte. + + + + + "\x0B" (ASCII 11 + (0x0B)), a . + + + - See also chop, rtrim and - ltrim. + You can also specify the characters you want to strip, by means + of the charlist parameter. + Simply list all characters that you want to be stripped. With + .. you can specify a range of characters. + + + Usuage example of <function>trim</function> + + + +]]> + + + + + + The second parameter was added in PHP 4.0.7 + + + + See also ltrim and rtrim.