login

strtrim.gsf

Top / GrADS / script / strtrim.gsf

Japanese / English

Name

strtrim() - Trim white space in the string.

Synopsis

ret = strtrim( str, opt )

Options and Return values

fn
File number.
str
Input string.
opt
"l" (only head), "r" (only tail) or "" (both). opt="" for both.
ret
Resulting string.

Examples

(1) Explanation of example.

  • test.gs
    rc = gsfallow( 'on' )
    str = '  This is a pen.  '
    say strtrim( str )
    
  • console
    ga-> test
    This is a pen.
    

Script source code