Results 1 to 13 of 13

Thread: Replace statment

  1. #1
    chenko
    Guest

    Question Replace statment

    Is there a way I can use the Replace statment so it ignores case?

  2. #2
    Lively Member
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    115
    Code:
    Replace(lcase(sText),"text to replace","text to replace with")
    That should be working just fine (if I didn't mess up the syntax )

  3. #3
    chenko
    Guest
    Well If I do that then it will change all the output text to lower case

  4. #4
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    You can use vbTextCompare... use a 1

    Replace( strYourString, strToReplace, strReplacement, 1)

    should do it...

    The full syntax is:

    Replace( string, stringToReplace, replacementString [, start [, count[, compare]]])



    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  5. #5
    chenko
    Guest
    I tried that and it didnt work, No error either

  6. #6
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    That's strange...can you post the line that's giving you the trouble?


    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  7. #7
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Did you try:
    Replace( strMyString, strToReplace, strReplacement, 0, len(strMyString), 1)


    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  8. #8
    chenko
    Guest
    Well I used


    Replace( strMyString, strToReplace, strReplacement, 0, Len(strMyString), 1)

    I will try yours

  9. #9
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    That should've worked...


    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  10. #10
    chenko
    Guest
    I tired it and it didnt work, It gave me a "Object Required Error" on the same line

  11. #11
    chenko
    Guest
    I tired it and it didnt work, It gave me a "Object Required Error" on the same line.


    you sure its supposed to be 1?

  12. #12
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    The constant for vbTextCompare is 1


    Chris
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  13. #13
    chenko
    Guest
    Still dosent work for me

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