PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
String Parsing
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
String Parsing
![]() |
String Parsing |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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]; |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Or you could load that into a DateTime and access the DateTime.Day etc...
shrenik wrote: > 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]; > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

