Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spliting multiple lines
#1
Solved: 11 Years, 3 Months ago MyBB 
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
Reply
#2
Solved: 11 Years, 3 Months ago
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)
Reply
#3
Solved: 11 Years, 3 Months ago
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
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Solved: 11 Years, 3 Months ago
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?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Solved: 11 Years, 3 Months ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to run multiple iterations only on a set of lines in script amit25007 0 2,428 05-17-2016, 10:48 AM
Last Post: amit25007
  Comapre txt file with different number of lines anushreebehura 0 1,721 06-02-2015, 06:28 PM
Last Post: anushreebehura
  Replace LInes of text with a keyword bjotorres 1 2,052 12-04-2008, 02:59 PM
Last Post: roxer

Forum Jump:


Users browsing this thread: 1 Guest(s)