Split ExamplesΒΆ

Returns a string array containing substrings that are deliminated by a specialize element.

Note

Split is not always the best method to create substrings. For more information on this, please read the following documentation

General syntax for this method:

stringName.Split(deliminator)

Example

1
2
3
4
5
6
7
8
string duck = "Duck, duck, goose!";

string[] substrings = duck.Split(' ');

foreach(string sub in substrings)
{
   Console.WriteLine(sub);
}

Output

Duck,
duck,
goose!