Split a string

From TRCCompSci - AQA Computer Science
Revision as of 10:05, 20 May 2024 by Admin (talk | contribs) (Created page with "You can take a string and split it using a separating character: <syntaxhighlight lang=csharp line> Console.WriteLine("Comma separated strings"); // String of Vowels string v...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You can take a string and split it using a separating character:

1 Console.WriteLine("Comma separated strings");
2 // String of Vowels
3 string vowels = "A,E,I,O,U";
4 // Split vowels separated by a comma followed by space
5 string[] VowelList = vowels.Split(",");
6 foreach (string v in VowelsList)
7   Console.WriteLine(v);