String Parsing

  • Thread starter Thread starter Beebs
  • Start date Start date
B

Beebs

I have what probably is a simple question. I have a string like this:

Wednesday, March 08, 2006

I need to separate four values out of this without the white spaces.
First I need the day "Wednesday", then I need the Month, "March", then
the number day "08", then the year, "2006".

Can anyone tell me where to find a similar example or can someone
provide a code snippet that would show me what I need to do. Three of
the values can go by the comma locations and chop off the white space
I assume, the number day is probably a little harder to get out
though.

Thanks
 
Annoyingly lame solution...but since you're asking for it

yourDateString = yourDateString.Replace(",",""); // removes the commas
string[] list = yourDateString.Split[" "]; // splits the string at the
spaces
string day = list[0];
string month = list[1];
string date = list[2];
string year = list[3];
 
Back
Top