How to get the substring in C#?

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-05-25T06:12:25Z Indexed on 2010/05/25 6:21 UTC
Read the original article Hit count: 157

Filed under:
|

Hi, I can get the first three characters with the function below.

However, how can I get the output of the last five characters (Three) with Substring() function. Or other string function will be used?

Thank you.

static void Main()
        {
            string input = "OneTwoThree";

            // Get first three characters
            string sub = input.Substring(0, 3);
            Console.WriteLine("Substring: {0}", sub); // Output One. 
        }

© Stack Overflow or respective owner

Related posts about c#

Related posts about string