string comparison

Ping Liu pliu at HAWAII.EDU
Wed Apr 20 18:02:24 EDT 2005


Should not use 'then' in the if-endif construction. Solved.

----- Original Message -----
From: Ping Liu <pliu at hawaii.edu>
Date: Wednesday, April 20, 2005 11:54 am
Subject: string comparison

> The following script is expected to say letter a but it says a to g
> oneby one. Any comments? GrADS version v1.8SL9.
>
> str='abcdefg'
> rec=math_strlen(str)
> i=1
> while(i<=rec)
> ss=substr(str,i,1)
> if(ss = 'a') then
> * What is wrong here?
> say ss
> endif
> i=i+1
> endwhile
>
> ga-> run teststr.gs
> a
> b
> c
> d
> e
> f
> g
>
>
>
>



More information about the gradsusr mailing list