Split()
noun
say it: “SPLIT” /splɪt/
A string method that cuts a string wherever a separator appears and returns the pieces as an array.
What is Split() in C#?
Split() — A string method that cuts a string wherever a separator appears and returns the pieces as an array of strings. It's how you read a line such as Dune,Herbert,1965 one value at a time.
string line = "Dune,Herbert,1965";
string[] parts = line.Split(',');
Console.WriteLine(parts[1]); // Herbert
In a sentence
- “I used Split(',') to break each line of the CSV file into its values.”
Level: Apprentice · More C# terms at this level
Updated