Get the substring

SubString returns the substring from the current.

Specify only the start position


using System;

class Sample
{
    public static void Main()
    {
        string s = "java2s.com";

        Console.WriteLine(s.Substring(2));
    }
}

The output:


va2s.com

Specify both the start and end


using System;

class Sample
{
    public static void Main()
    {

        string s = "java2s.com";

        Console.WriteLine(s.Substring(2, 3));
    }
}

The output:


va2
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.