What are the parameters of the substring method in C#?
In C#, the Substring method has two different parameter forms.
- One parameter is used: Substring(int startIndex)
- The startIndex parameter specifies from which index position to start extracting the substring. It returns the substring starting from the startIndex position until the end of the original string.
- Apply two parameters: Substring(int startIndex, int length)
- The startIndex parameter specifies from which index position to start extracting the substring.
- The length parameter specifies the length of the substring to be taken. It returns a substring of length starting from the position of startIndex.
Note: In C#, index positions are counted starting from 0.