Separate String

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
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!
*************************************************
 

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

Back
Top