Forum Discussion
You are right, I got the value.
If i want to split the value by carriage return(New Line) how can i do that?
Using Javascript i tire the below options,
1)
mycellvalue.split("\r\n")
2)
var testRE = RegExp("\r\n");
mycellvalue.split(testR)
3)
mycellvalue.split(chr(13);
nothing is working for me..
- tristaanogre10 years agoEsteemed Contributor
I haven't tried it myself, but have you looked into the aqString.Split() method? That is not using native JavaScript but an internal function of TestComplete so it MIGHT work differently.
- shankar_r10 years agoCommunity Hero
I guess instead of aqString.Split() we should use aqString.GetListItem() after setting up the aqString.ListSeparator.
I have tried that too.
aqString.ListSeparator = "\r\n"
aqString.GetListItem(mycellvalue,0);
aqString.ListSeparator = chr(13)
aqString.GetListItem(mycellvalue,0);but no luck.
- Colin_McCrae10 years agoCommunity Hero
Does "Replace" work?
It's what I tend to use to remove line feeds & carriage returns. (My use case is slightly different to yours, I want rid of them!)
I'm not a JavaScript guy, but it has that method apparently?
http://www.w3schools.com/Jsref/jsref_replace.asp
So if you did:
<YOUR-STRING> = <YOUR-STRING>.Replace(chr(10), "");
<YOUR-STRING> = <YOUR-STRING>.Replace(chr(13), "");
... are you left with one big long line of all the text from the cell?
I "replace" out these characters all the time (in VBScript & C# Script) no problem.