Name

trim — remove leading and trailing whitespace

Synopsis

string trim(str);
string str;

Description

Returns str with the leading and trailing whitespace removed. Whitespace is defined as those characters whose ASCII character codes are less than or equal to 0x20 (the space character).

Example 54. trim Example

string trimmed = trim("    Hello!    ");    // = "Hello!"

See Also

ltrim(), rtrim()