Micro Focus QTP (UFT) Forums
Spliting multiple lines - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Spliting multiple lines (/Thread-Spliting-multiple-lines)



Spliting multiple lines - cherrycheran - 02-26-2013

hi i need to split a line,
say like the line will be like....
hai 1.how are you 2.where are you 3.what are you doing.
i need it in this format
hai
1.how are you
2.where are you
3.what are you doing


RE: Spliting multiple lines - Jyobtech - 02-26-2013

Hi ,
try this
Code:
a="hai 1.how are you 2.where are you 3.what are you"
b=split(a," ")
msgbox b(0)&vblf&b(1)&" "&b(2)&" "&b(3)&vblf&b(4)&" "&b(5)&" "&b(6)&vblf&b(7)&" "&b(8)&" "&b(9)



RE: Spliting multiple lines - basanth27 - 02-26-2013

Code:
ArrVal = Split("hai 1.how are you 2.where are you 3.what are you doing"," ")

For intCounter = Lbound(ArrVal) to Ubound(ArrVal)
       msgbox ArrVal(i)
Next



RE: Spliting multiple lines - basanth27 - 02-26-2013

Do you really think this is required for a simple split and display? I mean, this may work but wouldnt it be the bull way of doing it?


RE: Spliting multiple lines - v4victory - 04-11-2013

Hi
above code is going to split for each spaces, so the result would be
hai
1.how
are
you
2.where
are
you... etc

So using regular expression we can achieve as per the requirement.

Thanks