C# String Substring(Int32)
Description
String Substring(Int32)
retrieves a substring from
this instance. The substring starts at a specified character position and
continues to the end of the string.
Syntax
String.Substring(Int32)
has the following syntax.
public string Substring(
int startIndex
)
Parameters
String.Substring(Int32)
has the following parameters.
startIndex
- The zero-based starting character position of a substring in this instance.
Returns
String.Substring(Int32)
method returns A string that is equivalent to the substring that begins at startIndex in
this instance, or Empty if startIndex is equal to the length of this instance.
Example
The following example demonstrates obtaining a substring from a string.
/*from w ww . j av a2 s . com*/
using System;
public class SubStringTest {
public static void Main() {
Console.WriteLine("this is a test".Substring(1));
}
}
The code above generates the following result.