Sign in to follow this  
Followers 0
dickep

Something wrong with my replace line

4 posts in this topic

OK, here is the text I have input:

$myText = "1967 New Yorker, V-8,124"" wb"

I want to replace the double quotes with the pipe character. I am using this line of code:

MsgBox(0,"Before", "Text before: " & $myText)

StringReplace($myText, '""', '|')

MsgBox(0,"After", "Text after: " & $myText)

However, when I look at the result, it has not changed. Why? What is wrong - besides me. I can't figure it out.

Thanks for the help.

E

Share this post


Link to post
Share on other sites



Try this:

$myText = '1967 New Yorker, V-8,124"" wb'
MsgBox(0,"Before", "Text before: " & $myText)
$myText = StringReplace($myText, '""', '|')
MsgBox(0,"After", "Text after: " & $myText)

Share this post


Link to post
Share on other sites

@dickep

Read the first MsgBox instead of just glance through it and you will notice something, the two "" is only " in the MsgBox. Why is that? I'm not gonna tell you when it's speller out perfectly in the helpfile. See Language Reference - Datatypes.

Share this post


Link to post
Share on other sites

GMK, thanks for pointing out my error. :)

AdmiralAlkex, I read that. I was just trying to see the pipe in the result but it did not show up. ;)

Both of you pointed out that I read the helpfile but did not READ the helpfile. Would have seen that you have put the "stuff" back into the variable. ;)

All is good now. Just need to finish the project and move the the next.

E

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0