Simple VB.net split line

Chronictank

FH is my second home
Joined
Jan 21, 2004
Messages
10,133
Hi all,
Just a quick question
I have the string "this is_stuff" and i want to split the line to get the result
a = this
b = is
c = stuff

I did the following:
Code:
' Holds results from split
dim result(2) as string
dim result2(2) as string

dim strline as string = "this is_stuff"

        result = strline.Split(" ")    'Split based on space character
        result2 = result(1).Split("_") 'Split second half of string based on _

        MessageBox.Show("a=" + result(0) + "b=" + result2(0) + "c=" + result2(1))

While this works, i am wondering if there is a better way to do this?
 

Genedril

Part of the furniture
Joined
Dec 29, 2003
Messages
1,077
I know you got the answer - just wondering if you'd tried vbforums.com? Interested 'cause I've got a friend who's a mod on there. I know he's good at vb but not sure how good the forums are....
 

SheepCow

Bringer of Code
Joined
Dec 22, 2003
Messages
1,365
Back away from the VB. You're better off doing stuff in C# as learning the C bits will help you learn other languages, where as VB is pretty much just VB.
 

Users who are viewing this thread

Top Bottom