#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Vb.net string.replace 1st instance only


    I am using vb.net and am using the string.replace() function, is there a way to limit so that it only replaces the 1st instance of a string?

    Or is there another function that will do this?

    Thanks
  2. #2
  3. ASP.Net MVP
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Aug 2003
    Location
    WI
    Posts
    4,319
    Rep Power
    1515
    Replace it manually, using .IndexOf() to find the index of the first occurance and .SubString() to pick apart the string at that index.
    Primary Forum: .Net Development
    Holy cow, I'm now an ASP.Net MVP!

    [Moving to ASP.Net] | [.Net Dos and Don't for VB6 Programmers]

    http://twitter.com/jcoehoorn
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0
    Thanks, can't believe I never thought of that!

IMN logo majestic logo threadwatch logo seochat tools logo