Phantom Documentation

[Help Home] [Phantom Home]
trim

string trim(string)

Return Type: string
Parameters: string input

Description:
This function removes all leading and trailing ‘white space’ (spaces, tabs, new lines '\n', carriage returns 'r') from the input string and returns the result. The input string is not modified.

Example Code
1 >>string s = "\tGo climb a mountain!    ";
2 >>disp(s);
    Go climb a mountain!
3 >>disp(getlength(s));
25
4 >>disp(trim(s));
Go climb a mountain!
5 >>disp(getlength(trim(s)));
20


Copyright 2000-2011 Phantom Automated Solutions