Version 0.60.0

str::trim

Removes whitespaces from both sides of a string.

Signatures

  •   string trim( string& input )

Details

The function removes whitespace (blank spaces, tabs, line breaks) from both sides of a string.

Example

 #import( "std/str.sps" )
 string s = "  \t\tHello World!\t\t
 ";
 echo( "-" + str::trim( s ) + "-" );
 

Output

 -Hello World!-
 

Return value

A copy of input with whitespaces removed on both sides.

Parameters

input

String the output is generated from by removing front and back whitespaces. The string is not modified by the operation.

See also

🗙

Search results for