listtotextwave with \000 as delimiter?

I've got a long string with \000 separating logical lines and want to put it into a 1D text wave.

listtotextwave doesn't seem to split on \000, I wind up with 2 rows which both appear empty while strlen shows the

string is 691 long.  it's likely/certain that the string starts with a \000 (the first line is a null line).

 

I can work around this, but would like to know if listtotextwave works this was or it's something

i"m doing...  (The string is coming from an XOP and I can see it's contents in the data browser).

 

 

Try this ...

Function SplitText(string textStr)
    string sep = "\000", tStr
    tStr = RemoveListItem(0,ReplaceString(sep,textStr,";"))
    wave/T twave = listToTextWave(tStr,";")
    duplicate/O twave, output
    return 0
end

> alongstr = "\000These are the times\000that try men's souls.\000The days are getting longer.\000The nights are getting shorter."
> splitText(alongstr)

 

There is infinite number of list separators people picked based on whatever justification. Any generic code will be able to identify just few common ones. Custom code is necessary...

You are lucky, that at least the separator is fixed set of characters. Imagine that someone, in their "geniality", would use increasing order of the string numbers as separator: "\000this is first line\001this is second line\002and this is third one\004I hope this nonsense is clear\005". 

thanks, that works, even without the RemoveListItem (the 0th is a null string and it comes out fine).