Substring()
noun
say it: “SUB-string” /ˈsʌbstrɪŋ/
A string method that returns part of a string, from a start position for a given number of characters.
What is Substring() in C#?
Substring() — A string method that returns part of a string. You give the start index, and optionally how many characters to take; with no length, it takes everything to the end.
string isbn = "978-0441172719";
Console.WriteLine(isbn.Substring(0, 3)); // 978
Console.WriteLine(isbn.Substring(4)); // 0441172719
In a sentence
- “I took the first three digits of the ISBN with Substring(0, 3).”
Level: Apprentice · More C# terms at this level
Updated