I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguelhello
you can use the String.Split method for that
http://authors.aspalliance.com/aspx...lasssplit1.aspx
string[] parts = MyString.Split (',');
parts[0] will be 'Name1' and parts[1] will be 'Name2'
HTH
"shapper" <mdmoura@.gmail.comwrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegrou ps.com...
Hello,
I have a string as follows:
MyString="Name1,Name2"
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
So String1 gets the characters on the left of "," and String2 the
characters on the right.
How can I do this?
Thanks,
Miguel
Dim MyString2 As String = MyString.Split(",")
MyString2(0) = "Name1"
MyString2(1) = "Name2"
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/
*************************************************
Think Outside the Box!
*************************************************
"shapper" <mdmoura@.gmail.comwrote in message
news:1160179555.140385.26930@.i3g2000cwc.googlegrou ps.com...
Quote:
Originally Posted by
Hello,
>
I have a string as follows:
MyString="Name1,Name2"
>
I want to create 2 strings from it:
String1 = "Name1"
String2 = "Name2"
>
So String1 gets the characters on the left of "," and String2 the
characters on the right.
>
How can I do this?
>
Thanks,
Miguel
>
0 comments:
Post a Comment