PDA

View Full Version : string to character array



hcrisp
08-27-2010, 02:07 PM
Can I use STRSPLIT to convert a single-element string into a string-array consisting of its individual characters?

Something like this?:



WAVE> x = STRSPLIT('abcdefghijkl','')
WAVE> info, x
X STRING = Array(1)
; Hoping it would be Array(12)

ed
08-27-2010, 02:14 PM
How about this?


s='abcdefghijkl'
x=string(reform(byte(s),1,strlen(s)))
info, x
X STRING = Array(12)


The REFORM is needed because otherwise the STRING function will squish the 1D byte array back together as a single string.