473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String\Delimite r

gh
I have a string that is delimited with commas. Is there a function in
C# that will break apart the string at each comma, so I can copy the
value to a var? This is a .net v1.1.4 app.
TIA
Jul 8 '08 #1
3 2108
"gh" <gh@att.netwrot e in message
news:OE******** ******@TK2MSFTN GP06.phx.gbl...
I have a string that is delimited with commas. Is there a function in C#
that will break apart the string at each comma, so I can copy the value to
a var? This is a .net v1.1.4 app.
http://www.google.co.uk/search?sourc...String%2eSplit
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 8 '08 #2
SAL
is the String.Split function in 1.1.4?

S

"gh" <gh@att.netwrot e in message
news:OE******** ******@TK2MSFTN GP06.phx.gbl...
>I have a string that is delimited with commas. Is there a function in C#
that will break apart the string at each comma, so I can copy the value to
a var? This is a .net v1.1.4 app.
TIA

Jul 8 '08 #3
gh wrote:
I have a string that is delimited with commas. Is there a function in
C# that will break apart the string at each comma, so I can copy the
value to a var? This is a .net v1.1.4 app.
The easiest way would be to use the Split method of the string class:

string[] subStrings = commaDelimitedS tring.Split(',' );

Often a string is actually delimited with a comma and a space, in that
case you would want to split on the string ", " instead:

string[] subStrings = commaDelimitedS tring.Split(new string[]{", "},
StringSplitOpti ons.None);

If the space after the comma is optional, you would use two delimiter
strings:

string[] subStrings = commaDelimitedS tring.Split(new string[]{", ",
","}, StringSplitOpti ons.None);

--
Göran Andersson
_____
http://www.guffa.com
Jul 9 '08 #4

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

Similar topics

21
2640
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225; }; forwarders { 4.2.2.2; }; };
4
6998
bilibytes
by: bilibytes | last post by:
Hi all! i am trying to figure how to subtract some string which is between two other strings: i have: for(lots of times){ some unuseful text and tags... <aloha some=text bbbbbbbbb>string</aloha> some text and other tags that i dont need. <aloha some=textDifferent bbbbbbbb> stringasdf</aloha>
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.