AtomSoft

helpJohnDoe

Mar 12th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. //Get Line into a string... as a test using prepared string
  2.     string value = "E-Mail : E-Mail : [email protected]";
  3.  
  4. // Use a new char[] array of ( : ) to break
  5. // lines from into separate strings. Use "RemoveEmptyEntries"
  6. // to make sure no empty strings get put in the string[] array.
  7. //
  8.     char[] delimiters = new char[] { ':' };
  9.     string[] parts = value.Split(delimiters,StringSplitOptions.RemoveEmptyEntries);
  10.    
  11.     for (int i = 0; i < parts.Length; i++)
  12.     {
  13.     Console.WriteLine(parts[i]);
  14.     }
  15.  
  16. // parts[0] should contain E-Mail :
  17. // parts[1] should contain [email protected]
Advertisement
Add Comment
Please, Sign In to add comment