Escolar Documentos
Profissional Documentos
Cultura Documentos
http://msdn.microsoft.com/en-us/library/ms228388
Example
class TestStringSplit { static void Main() { char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; string text = "one\ttwo three:four,five six seven"; System.Console.WriteLine("Original text: '{0}'", text); string[] words = text.Split(delimiterChars); System.Console.WriteLine("{0} words in text:", words.Length); foreach (string s in words) { System.Console.WriteLine(s); } // Keep the console window open in debug mode. System.Console.WriteLine("Press any key to exit."); System.Console.ReadKey();
} } /* Output: Original text: 'one 7 words in text: one two three four five six seven */
See Also
Concepts
1 of 2
5/25/2012 11:48 AM
How to: Split Strings (C# Programming Guide) C# Programming Guide Other Resources Strings (C# Programming Guide) .NET Framework Regular Expressions .NET Programming Guide
http://msdn.microsoft.com/en-us/library/ms228388
Yes
No
Community Content
2012 Microsoft. All rights reserved.
2 of 2
5/25/2012 11:48 AM