Is there any equivalent function to Split( ) in 4test language?
yes, but kinda-sorta...
There's a function called GetField (). What it does is gets a field based on a delimiter. So, using this function, you can write your own Split() method.
Hope this helps.
You can also use the functions..Left() and Right() and specify how many characters you are interested in from left or right of the string.
i have a code snippet for splitting strings
[+] integer split (string theString, inout list of string theList, string delimiter optional)
[ ] integer numberOfItems = 0, pos
[ ] boolean done = FALSE
[ ] string tempString
[+] if (delimiter == null)
[ ] delimiter = "|"
[+] if (theString == "")
[ ] done = TRUE
[+] while (!done)
[ ] pos = StrPos (delimiter, theString)
[+] if (pos == 0)
[ ] pos = Len(theString) + 1
[ ] done = TRUE
[+] if (Len(theString) == 0)
[ ] tempString = ""
[ ] tempString = Left (theString, pos - 1)
[ ] ListAppend(theList, tempString)
[ ] numberOfItems = numberOfItems + 1
[+] if (!done)
[ ] theString = Right (theString, Len(theString) - pos)
[ ] return numberOfItems
Note: this function needs 3 arguments
1. string to split
2. list of string to hold the split resultant strings
3. delimiter (default will be "\")
we can use the list of string to retrive the required portion
hope this helps
Try and fail, but don't fail to try
Nice function, thanks for posting! You should stick it in the pinned user defined function thread.
Jody Reed email@example.com
You can see the earlier post => http://www.sqaforums.com/showflat.php?Cat=0&Number=491378&an=0& page=1#Post491378
Thanks & Regards,
Quote: Donít hesitate to initiate!