C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String SubString()The C# SubString() method is used to get a substring from a String. The substring starts at a specified character position and continues to the end of the string. Signaturepublic string Substring(Int32 index) public string Substring(Int32, Int32) Parameterindex: it is an integer type parameter which is used to pass index to get a substring. ReturnIt returns a string. C# String SubString() Method Example
using System;
public class StringExample
{
public static void Main(string[] args)
{
string s1 = "Hello C Sharp";
string s2 = s1.Substring(5);
Console.WriteLine(s2);
}
}
Output: C Sharp
Next TopicC# String ToCharArray()
|