Guest User

Untitled

a guest
Aug 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. using System;
  2. using com.wms.strings;
  3.  
  4. namespace PracticeAssigningDateTimes{
  5. class DateTimeAssignments{
  6. static void Main(){
  7. string[] sToBeParsed = new string[] {
  8. "7-7-90",
  9. "July 7, 1990",
  10. "7/7/1990 18:43:24",
  11. "Jul the 7th 1990"
  12. };
  13.  
  14. int iSuccessfullyParsed = 0;
  15.  
  16. foreach(string p in sToBeParsed)
  17. {
  18. if(StringManipulator.ParseableToDateTime(p))
  19. {
  20. iSuccessfullyParsed++;
  21. }
  22. }
  23. Console.Write("Of the {0} elements in string array", sToBeParsed.Length);
  24. Console.Write(" \"sToBeParsed\", ");
  25. Console.WriteLine("{0} were parseable to DateTime values.",
  26. iSuccessfullyParsed);
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment