Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. //works
  2. int index = richTextBox1.Text.IndexOf(' ', 0);
  3. int index = richTextBox1.Text.IndexOf('n', 0);
  4.  
  5. //doesn't work
  6. int index = richTextBox1.Text.IndexOf('\s', 0);
  7. int index = richTextBox1.Text.IndexOf("\s", 0);
  8.  
  9. public static void Main()
  10. {
  11. var wsChars = Enumerable.Range(0, ushort.MaxValue)
  12. .Where(c => char.IsWhiteSpace(Convert.ToChar(c)))
  13. .Select(c => Convert.ToChar(c)).ToArray();
  14.  
  15. Console.WriteLine(wsChars.Length);
  16.  
  17. var someText = "This_is_atstring with nsome whitespace characters.";
  18.  
  19. Console.WriteLine(someText.IndexOfAny(wsChars));
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement