string plus string

From: Mark Chan <cym263_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 18 2011 - 16:59:51 MDT

NCL users,

If "x" is a string array like this:

aaa1 aaa2
bbb1
ccc1 ccc2
ddd1
eee1

I want to make a NCL script as:

      s1 = str_get_field(x(1:),1," ")
      s2 = str_get_field(x(1:),2," ")
      if (s2.ne."null") then ;------------------how to judge "s2" here
      ss =s1+" "+s2
      else
      ss=s1
      end if

The aim is plus "s1" and "s2" with a space between only if "s2" has value.
Otherwise the string "ss" would have extra space (e.g. ss=s1+" "), which damage
the variable name.
Can any one help!

Thanks very much.

Mark

      
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 18 16:59:58 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2011 - 16:15:59 MDT