This article illustrates the different techniques to remove the first character from a string in C#.

1. Using Range Operator

Starting from C# 8, we can use the range operator to remove the first character from a string in C#. The range operator takes the start and the end from a range as its operands, and can be used as follows to remove the first character from a string.

Download  Run Code

2. Using String.Substring() method

Another option is to use the String.Substring() method, which can create a substring of a string starting from the second position till its end. The following code example shows how to use this option:

Download  Run Code

3. Using String.TrimStart() method

Finally, you can use the String.TrimStart() method to remove all occurrences of a specific character from the beginning of a string. For example, the following code removes all instances of the dot character (.) from the start of a string.

Download  Run Code

4. Using String.Remove() method

However, if you need to remove only the first occurrence of a character from any position in the string, you can find its index and pass the index to the String.Remove() method. The following example demonstrates its usage.

Download  Run Code

That’s all about removing the first character of a string in C#.