User Robert Lauzon ( posted:

I'm at home right now and don't have WinRunner in front of me to test it,
but what about:

count = split(line,array,MyVar);

Won't that work ?



----Original Message Follows----
From: Richard McCrae <>
Subject: Re: [winrunner] split() function
Date: Tue, 24 Apr 2001 21:14:10 -0400

I tried your code outside of a function, and it didn't work the way you
believe it should (or, at least, what I understand you to believe). The
help on split (WR 7) states that it is supposed to break the line on the
'single character separator', so not much room for complaint there. How
about a work around. Instead of using split, index the '\r\n' and then
break out the elements you want using substr. It's only a couple of
lines of code and will work.


Rick McCrae
"Shum, Garry" wrote:

> I need to use split() with the following string and separator...
> line = "This is a \r\n an example of a \r\n string with exactly \r\n
> four instances of the \r\n linefeed and newline characters.";
> count = split(line,array,"\r\n");
> ...the above does not work properly """IF""" you place it within a
> custom function. When the above is placed within a custom function,
> any instances of "\r\n" will not be found. If I use either "\r" or
> "\n", it will not work as well. If I use "\\r" or "\\n" it will split
> every occurance of the letter(s) "r" and "n" rather than the linefeed
> and newline characters. How do I get this working?