HyperMath

string.trim

string.trim

Previous topic Next topic No expanding text in this topic  

string.trim

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Removes the trailing and leading whitespace from a string.

Syntax

r = string.trim(str)

Argument

Name

Description

 

str

A string.

Outputs

Name

Description

 

r

A string.

Example

To remove the leading and trailing white space.

 

Syntax    

 

str = ' This is a string with spaces at the beginning and at the end. ' ;

r = string.trim(str);

print('|' + str + '|');

print('|' + r + '|');

 

Result

 

| This is a string with spaces at the beginning and at the end. |

|This is a string with spaces at the beginning and at the end.|