473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Separate String

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

Oct 6 '06 #1
3 1197
hello

you can use the String.Split method for that

http://authors.aspalliance.com/aspxt...asssplit1.aspx

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

HTH

"shapper" <md*****@gmail.comwrote in message
news:11*********************@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

Oct 7 '06 #3
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" <md*****@gmail.comwrote in message
news:11*********************@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

Oct 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jaime Wyant | last post by:
I know I've seen this somewhere, but can't seem to google it. Is there a way to use an alternate statement separator, other than the default ';'? jw
2
by: Stian | last post by:
Hi! I have made a form with two SELECT LIST-boxes where the first is dynmically filled when you enter the page, and then one can select multiple options from the list and move across to the...
3
by: Roberto Becerril | last post by:
Hi forum, i'm a little new in javascript and maybe you can help me. I have an html form and an icon, if i click on the icon, a new pop-up window is open and shows a list of numbers with a...
3
by: harhaiko | last post by:
Hello, I have 4,4 million rows of data in one column. I want to search for a string in each line. There are random amount of characters before the string I want to find. The string starts with the...
2
by: ad | last post by:
I have a string vaiable like "1a3345"; How to separate the string into a char array or a string array just have on character per element?
28
by: kfrost | last post by:
I know this is probably simple but I have a C# form and the class for the form is called sbaSynch. I have a textbox name txtServerName. I'm creating a class to manipulate XML functions so I...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
1
by: drec | last post by:
I have a very simple mysql/php script that is being used to store program keys in a db for multiple users. I would like to add the ability to send these string values to another application. In...
2
by: colleen1980 | last post by:
Hi: Can any one please tell me how do i separate city state and zip. I ask this question in previous post. But when the city name is in two words it mess up my values otherwise it works. ...
14
by: Lambda | last post by:
I'd like to create separate character pointers, pass them to a function to assign each one different value, and assign the pointers to an array. But when I try: #include <stdio.h> #include...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.