locked
How To use substring on string RRS feed

  • Question

  • How To use substring on string...
    • Edited by Andreas Johansson Thursday, August 11, 2011 8:31 AM Fixed question and subject
    Thursday, August 11, 2011 5:06 AM

Answers

  • Hello

    you can use it in the following way.

        string strInput= "SubStringExample";

        // Get first three characters
        string subString =strInput.Substring(0, 3);
       Response.Write("Substring: " +  subString );

     

    Also you can go through the following article to get more examples.

    http://programming.top54u.com/post/ASP-Net-C-sharp-Substring-String-Function.aspx

     

    Hope it helps.


    Kathir
    • Edited by karurkathir Thursday, August 11, 2011 6:03 AM Added a web link
    • Proposed as answer by karurkathir Thursday, August 11, 2011 6:03 AM
    • Marked as answer by Min Zhu Wednesday, August 17, 2011 1:33 AM
    Thursday, August 11, 2011 6:00 AM
  • This article describes the two overloads of the Substring() method and gives simple code examples:

    http://msdn.microsoft.com/en-us/library/system.string.substring.aspx

     

    • Marked as answer by Min Zhu Wednesday, August 17, 2011 1:33 AM
    Thursday, August 11, 2011 1:00 PM

All replies

  • Hello

    you can use it in the following way.

        string strInput= "SubStringExample";

        // Get first three characters
        string subString =strInput.Substring(0, 3);
       Response.Write("Substring: " +  subString );

     

    Also you can go through the following article to get more examples.

    http://programming.top54u.com/post/ASP-Net-C-sharp-Substring-String-Function.aspx

     

    Hope it helps.


    Kathir
    • Edited by karurkathir Thursday, August 11, 2011 6:03 AM Added a web link
    • Proposed as answer by karurkathir Thursday, August 11, 2011 6:03 AM
    • Marked as answer by Min Zhu Wednesday, August 17, 2011 1:33 AM
    Thursday, August 11, 2011 6:00 AM
  • This article describes the two overloads of the Substring() method and gives simple code examples:

    http://msdn.microsoft.com/en-us/library/system.string.substring.aspx

     

    • Marked as answer by Min Zhu Wednesday, August 17, 2011 1:33 AM
    Thursday, August 11, 2011 1:00 PM