Click here to Skip to main content
15,926,382 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to change cursor when mouse is moved over PrintPreviewControl Pin
sachinkalse20-May-04 18:30
sachinkalse20-May-04 18:30 
GeneralRe: How to change cursor when mouse is moved over PrintPreviewControl Pin
Dave Kreskowiak21-May-04 0:28
mveDave Kreskowiak21-May-04 0:28 
GeneralStrip commas Pin
Odyssey3619-May-04 18:35
Odyssey3619-May-04 18:35 
GeneralRe: Strip commas Pin
Heath Stewart19-May-04 18:46
protectorHeath Stewart19-May-04 18:46 
GeneralRe: Strip commas Pin
Bee Master19-May-04 19:08
Bee Master19-May-04 19:08 
GeneralRe: Strip commas Pin
Uwe Keim19-May-04 23:24
sitebuilderUwe Keim19-May-04 23:24 
GeneralRe: Strip commas Pin
Bee Master20-May-04 5:09
Bee Master20-May-04 5:09 
GeneralRe: Strip commas Pin
Bitwise Gamgee20-May-04 5:22
Bitwise Gamgee20-May-04 5:22 
<br />
string s = "\"01\",\"test\",\"this,is the,problem\",\"test\"";<br />
string[] values = Regex.Split(s, @"(?<=\x22)\s*,\s*(?=\x22)");<br />
foreach (string val in values)<br />
	Console.WriteLine(val);


OUTPUT:

"01"
"test"
"this,is the,problem"
"test"



Note that this solution requires every field to be delimited with double-quotes. If some fields are not (as often the case with CSV numeric data) the Split above will not work. However, such data is still certainly within the capabilities of a RE parse … instead of the RE Split, you would capture the desired data in the Groups collection using Match … the RE would describe the values you want; and not the space between them (as in the split above).

Also note that I used zero-width look-ahead and look behind assertions to keep the double quotes on the values. If you did not want them as part of the value, the Split RE would look as follows: @"\x22\s*,\s*\x22". You would then have to remove a double quote at the beginning of the first value and one at the end of the last.
GeneralRTF - Codes Pin
Moon Boy19-May-04 14:12
Moon Boy19-May-04 14:12 
GeneralRe: RTF - Codes Pin
Charlie Williams19-May-04 17:28
Charlie Williams19-May-04 17:28 
GeneralDataGrid, Generic GDI+ errors, and a Big Red X Pin
inyoursadachine19-May-04 13:30
inyoursadachine19-May-04 13:30 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
Heath Stewart19-May-04 13:52
protectorHeath Stewart19-May-04 13:52 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
inyoursadachine19-May-04 14:22
inyoursadachine19-May-04 14:22 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
Heath Stewart19-May-04 18:28
protectorHeath Stewart19-May-04 18:28 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
inyoursadachine20-May-04 5:41
inyoursadachine20-May-04 5:41 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
Heath Stewart20-May-04 5:47
protectorHeath Stewart20-May-04 5:47 
GeneralRe: DataGrid, Generic GDI+ errors, and a Big Red X Pin
ABean19-May-04 15:11
ABean19-May-04 15:11 
GeneralC#'s sprintf Pin
ABean19-May-04 13:19
ABean19-May-04 13:19 
GeneralRe: C#'s sprintf Pin
Heath Stewart19-May-04 13:24
protectorHeath Stewart19-May-04 13:24 
GeneralRe: C#'s sprintf Pin
ABean19-May-04 13:26
ABean19-May-04 13:26 
GeneralRe: C#'s sprintf Pin
ABean19-May-04 13:25
ABean19-May-04 13:25 
GeneralRe: C#'s sprintf Pin
Heath Stewart19-May-04 13:32
protectorHeath Stewart19-May-04 13:32 
GeneralRe: C#'s sprintf Pin
ABean19-May-04 13:46
ABean19-May-04 13:46 
GeneralMysterious behaviour (freezing) Pin
GuntherR19-May-04 12:40
GuntherR19-May-04 12:40 
GeneralRe: Mysterious behaviour (freezing) Pin
je_gonzalez19-May-04 18:02
je_gonzalez19-May-04 18:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.