login

find.gsf

Top / GrADS / script / find.gsf

Japanese / English

Name

find() - Get position of the string in the string.

Synopsis

ret = find( str_base, str_target )

Options and Return values

str_base
String to search in.
str_target
String to find in str.
ret
Position of the string str_target in the string str_base (>0). ret=-1 unless it exists.

Examples

(1) Search for a string.

  • test.gs
    rc = gsfallow( 'on' )
    str = 'Tokyo Ueno Oomiya Sendai Morioka'
    say find( str, 'Sendai' )
    say find( str, 'Utsunomiya' )
    
  • console
    ga-> test
    19
      
-1

Script source code