Results 1 to 5 of 5

Thread: [RESOLVED] Replace string value in a string

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    Geneva, Switzerland
    Posts
    9

    Resolved [RESOLVED] Replace string value in a string

    Dear all,

    i'm trying to make the following code work... but, something not understandable happens, ie when i'm trying to replace "01" in the the string "01020304050607080910111213", it doesn't only remove the "01" at the beginning but the "10" in the middle ??? Can anyone help ?

    Sub toto1()
    Dim valuetoreplace As String
    valuetoreplace = "01"
    Dim myval As String
    myval = "01020304050607080910111213"
    Dim mynewval As String
    mynewval = Replace(myval, valuetoreplace, "")
    Debug.Print mynewval
    End Sub

    Thanks in advance for any help !

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Replace string value in a string

    did you add Option Explicit in the top of the code?

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    Geneva, Switzerland
    Posts
    9

    Re: Replace string value in a string

    Hi, thanks for the reply but no. Unfortunately, that doesn't solve the problem either. I really don't get it...

  4. #4
    Hyperactive Member
    Join Date
    Sep 2009
    Location
    Lost in thought
    Posts
    349

    Re: Replace string value in a string

    You have two "01"
    Code:
            "01"..............."01"
    myval = "01020304050607080910111213"
    "01020304050607080910111213"
    '01'02030405060708091'01'11213
    Last edited by 5ms?; Oct 20th, 2009 at 05:22 PM. Reason: To say You're welcome
    .

    The answer to your question is Here
    And here
    C:\Program Files\Microsoft Visual Studio\MSDN98\98VSa\1033\SAMPLES\VB98

    Please go to the "Thread Tools" menu at the top of this Thread, and click "Mark Thread Resolved" when you have your answer.
    So I can fine the answer when I need it.

    how to stop the playsound when it is in loop..Play more than 1 sound at a time..
    ini file Check if IP changed Strings 'Split', 'Left' and 'Right'
    Save And Load an Array of list-boxes, to and from a file......list-box and CommonDialog
    Quote Originally Posted by RobDog888

    So please install VB6 service pack 6 as its the latest and last supported service pack MS will ever make.
    http://support.microsoft.com/kb/q198880/ I'm sure this will fix your issue
    The only reason some people get lost in thought is because it’s unfamiliar territory. —Paul Fix

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Location
    Geneva, Switzerland
    Posts
    9

    Re: [RESOLVED] Replace string value in a string

    Gosh i'm stupid... of course... Too many hours in front of the pc... Thanks a lot, 5ms? (as well as to justa lol).

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