Separate String

S

shapper

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
 
S

Siva M

string[] parts = MyString.Split (',');
parts[0] will be 'Name1' and parts[1] will be 'Name2'

HTH

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
 
C

Cowboy \(Gregory A. Beamer\)

Dim MyString2 As String = MyString.Split(",")

MyString2(0) = "Name1"
MyString2(1) = "Name2"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,301
Latest member
BuyPureganics

Latest Threads

Top