[ncl-talk] Help with strings

Wei Huang huangwei at ucar.edu
Mon Apr 20 10:04:52 MDT 2015


Siva,

Try this:

 date = str_get_field(data(1::),  2," ")
 time = str_get_field(data(1::),  3," ")

 strs = str_sub_str(date + " " + time, "'", "")
 print(strs)


Wei



================================================
1850 Table Mesa Dr.
Boulder, CO 80307
Phone: 303-497-8924

On Mon, Apr 20, 2015 at 9:41 AM, Prasad, Siva <sp4436 at mun.ca> wrote:

> Hello everyone,
>
> Can anyone please help me with the following problem. I have an ascii
> file with two string fields like
>
>  data          field_1          field_2
>  0.01     '16-JAN-2003 23:22:20.10'
>  0.02     '16-JAN-2003 23:22:25.25'
>  0.03     '16-JAN-2003 23:22:30.40'
>  0.01     '16-JAN-2003 23:22:35.56'
>  0.02     '16-JAN-2003 23:22:40.70'
>  0.11     '16-JAN-2003 23:22:45.85'
>
> I want to combine these two fields into one and then find time units
> since 01-Jan-2003.   I tried using a do loop to read the strings and
> use str_concat to combine them, but it doesn't seem to work
>
>  date = str_get_field(data(1::),  2," ")
>  time = str_get_field(data(1::),  3," ")
>
>   do i =0, 5
>   strs(i)=(/date(i), time(i)/)
>   Pipetime(i) = str_concat(strs(i))
>   end do
>   print(strs)
>
>
> Thanks
> Siva
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150420/0526f434/attachment.html 


More information about the ncl-talk mailing list