Table of Contents

trim

WMMEGA FW >= 2.1170

Remove whitespace from string

Description

string trim ( string $input )

Parameter

$input: A string

Return Values

A string with whitespace characters removed from the beginning and end of the string

Whitespace characters are:

CharacterDescription
' 'space
'\n'newline
'\t'horizontal tab
'\v'vertical tab
'\f'form feed
'\r'Carriage return

Example

<?
  $str="   This had some space.   ";
  $str=trim($str);
  print($str); // Prints "This had some space."
?>

See Also

charat() - Return the ASCII code for a character in a string at an index

strlen() - Return the length of a string

strpos() - Return the position of the first occurrence of a needle in a haystack

strrpos() - Return the position of the last occurrence of a needle in a haystack

strtolower() - Return the lowercase version of a string

strtoupper() - Return the UPPERCASE version of a string

substr() - Return part of a string