str_split_by_length doesn't add a string terminator

From: Merrill Bean <mrbean_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 31 2013 - 10:10:52 MST

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
Received on Thu Jan 31 10:11:10 2013

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