How it works...
The TrimStart() method removes the specified character from the beginning of the string. The TrimEnd() method removes the specified character at the end of the string. If we have to remove the same character at both ends of the string, we use the Trim() method with the specified character. If you do not specify any character as the argument to any of the methods, white space will be removed from the string.
The split() method splits the strings at the specified character, and creates an array of the split strings.
We use the index operator to pick the fifth value from the array. Then, we find the index of the hyphen within the resultant string. Next, we create a substring using the Substring() method and instruct it to start ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access