Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    multi replace with 2 character (2000 sr-1)

    admit have myvar=aa-aaaaaa/a is possible to use replace statement with this 2 condition...
    replace - and / with ""
    similar:

    replace(aa-aaaaaa/a),"-","/","")
    result
    aaaaaaaaaa

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: multi replace with 2 character (2000 sr-1)

    You cannot do that in one go, but you can nest two calls to the Replace function:
    <code>
    myvar = Replace(Replace(myvar, "-", ""), "/", "")
    </code>
    This could be done with more replacements, but the code becomes hard to read and to edit. Using two separate Replace statements is easier:
    <code>
    myvar = Replace(myvar, "-", "")
    myvar = Replace(myvar, "/", "")
    </code>
    This can be extended without any problem to many replacements.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: multi replace with 2 character (2000 sr-1)

    I think the second way is the best!
    tks.

Posting Permissions

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