Re: str_split_by_length doesn't add a string terminator

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 31 2013 - 11:46:04 MST

Merrill,

It is a bug actually.
We checked the code, it seems that the first splitter string
is not guaranteed to have a terminator (we tested on few
machines here, it did not show up. But we should have
a terminator to guarantee the string is terminated correctly).

We have fixed this problem, and the fix will be in 6.1.1
(which will be released very soon).

Thanks,

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Jan 31, 2013, at 10:10 AM, Merrill Bean <mrbean@nmsu.edu> wrote:

> While getting a substring using str_split_by_length I get extra characters because there isn't always a
> string terminator. Happens on the command line too. But not all the time...
>
> ncl 0> a="20120101"
> ncl 1> print(a)
>
>
> Variable: a
> Type: string
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 20120101
>
> ncl 15> c=str_split_by_length(a,4)
> ncl 16> print(c)
>
>
> Variable: c
> Type: string
> Total Size: 8 bytes
> 2 values
> Number of Dimensions: 1
> Dimensions and sizes: [2]
> Coordinates:
> (0) 2012?=
> (1) 0101
>
> ncl 19> print(strlen(c(0)))
> (0) 7
>
> I changed my code to use stringtochar and chartostring to get the substring I need, but it looks like a
> bug to me.
>
> NCAR Command Language Version 6.1.0
> Linux 2.6.32-45-generic #102-Ubuntu SMP Wed Jan 2 21:53:06 UTC 2013 i686 GNU/Linux
>
> Merrill
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 31 11:46:17 2013

This archive was generated by hypermail 2.1.8 : Fri Feb 01 2013 - 15:31:04 MST