Results 1 to 4 of 4

Thread: [2005] What's the best way to change a value in a string?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    211

    [2005] What's the best way to change a value in a string?

    I have a string:
    Code:
    myString = "A=Bob, B=Cat, C=Tomato, and the crowd goes wild"
    I want to always change C to C=Potato. No matter what already is there (wont always be Tomato).

    In VB6 I did this:

    Code:
    start = InStr(1, UCase(myString), UCase("C=")) + Len("C=")
    pos_end = InStr(start + 1, myString, ",")
    NewString = Mid(myString, 1, start) & "Potato" & Mid(myString, pos_end)
    Which worked fine, but I wondered if there was a better way for VB2005
    Last edited by DssTrainer; Jun 21st, 2007 at 03:15 PM.

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