On Mon, 5 Dec 2011, Allin Cottrell wrote:
On Mon, 5 Dec 2011, Sven Schreiber wrote:
> Alternatively, would it work to process strColindices further with:
> strsub(strColindices,"\n","")
Seems like it probably should, but in fact the \n escape is not recognized as
a single character to be replaced.
Ah, that's because the string-substitution target, "\n", is
created on the fly as a string literal, in which escape
sequences are not recognized. This behavior makes it easier to
do things like
string filename = "c:\some-path\newfile"
But newlines can be substituted out of a string if you use
sprintf to create the target string, as in
<hansl>
sprintf str "some stuff\n"
printf "str = '%s'\n", str
sprintf target "\n"
string trimmed = strsub(str, target, "")
printf "trimmed = '%s'\n", trimmed
</hansl>
Allin