String Class

trim()

String::trim, trim, String.trim

Removes any leading and trailing whitespace (space or tab) from the string.

// SYNTAX
string.trim()

// PROTOTYPE
String& trim(void);

Parameters:

  • string: a variable of type String

Returns: A reference to the String object (*this). This refers to the String object itself, which has been modified, not a copy.