Results 1 to 4 of 4

Thread: Use of String functions

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Location
    Dhaka, Bangladesh
    Posts
    40

    Use of String functions

    How can I use SUBSTRING and INSTRING in C# ?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Use of String functions


  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Use of String functions

    Use the Substring and IndexOf methods of the String class.
    Code:
    string str = "Hello World";
    
    MessageBox.Show(str.Substring(3, 4)); // Displays "lo W"
    MessageBox.Show(str.IndexOf('W').ToString()); // Displays 6
    Note that .NET 2.0 strings have a Contains method as well.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2006
    Location
    Dhaka, Bangladesh
    Posts
    40

    Re: Use of String functions

    Thanks for your answer.

    Sohel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width