VB.NET split()?

wtbonnell

Freshman
Joined
Oct 6, 2003
Messages
32
I want to be able to split a string that has a space in it, but I am unsure how to lay out the code.

For example:

Dim name as String
name = "John Doe"

How do I split the string to get the value to be = "Doe"




Thanks...
 
answer

you will need to delare an array
everymember of an array will have a part of a splitted text

Code:
Dim Text() as string
text = microsoft.visualbasic.split("hello world", " ")
' as u can c it will split it by a space 
'now text(0) will have the hello word
'and text(1) will have the world word 

Enjoy!!
 
You don't need to use the split function from the legacy VB. All strings have the Split method which requires no external libraries (many have also mentioned that it's better to avoid the VB & other language legacy functions).
Visual Basic:
Dim Sarr() As String
Sarr = "John Doe".Split(" "c)
:)
 
Back
Top