Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 08 Jul 2008 17:27:34 -0500,    group: microsoft.public.dotnet.framework.aspnet        back       


String\Delimiter   
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
date: Tue, 08 Jul 2008 17:27:34 -0500   author:   gh

Re: String\Delimiter   
"gh"  wrote in message 
news:OEWwTnU4IHA.2580@TK2MSFTNGP06.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?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GZEZ_en-GBGB252GB252&q=%22C%23%22+String%2eSplit


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
date: Tue, 8 Jul 2008 23:40:59 +0100   author:   Mark Rae [MVP]

Re: String\Delimiter   
is the String.Split function in 1.1.4?

S

"gh"  wrote in message 
news:OEWwTnU4IHA.2580@TK2MSFTNGP06.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
date: Tue, 8 Jul 2008 15:41:08 -0700   author:   SAL am

Re: String\Delimiter   
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 = commaDelimitedString.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 = commaDelimitedString.Split(new string[]{", "}, 
StringSplitOptions.None);

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

string[] subStrings = commaDelimitedString.Split(new string[]{", ", 
","}, StringSplitOptions.None);

-- 
Göran Andersson
_____
http://www.guffa.com
date: Wed, 09 Jul 2008 16:59:53 +0200   author:   Göran Andersson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us