|
-
Apr 22nd, 2004, 01:33 AM
#1
Thread Starter
Junior Member
Replace double quotes (") with single quotes (')
Hi,
I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code:
text= Replace(text, """", "'")
This works fine (for normal double quotes).The problem comes in when you copy a double quote from word and paste it in the text box. What happens is the double quote becomes slanted (“) so my code above can't filter it. I tried to do this:
text= Replace(text, "““","'")
but what happens is that after typing this, vb automatically converts it to the normal double quote ("). I already tried:
text= Replace(text, chr(34), "'") ' 34 is the ascii of double quotes (")
but still, it won't work. I can't seem to find the ascii of the slanted double quotes, they somehow look all the same to me 
Is there a work around for this?
Thanks.
-
Apr 22nd, 2004, 03:01 AM
#2
You could use Regular Expressions for this (especially if you are running many different types of text replacement operations).
Be warned though, once you start, you'll be addicted for life.
Look up Regex in MSDN for more info.
or you could just use:
asc("“")
to find out the ascii value 
Regex is dead powerful though and you should learn it. IMHO
I don't live here any more.
-
Apr 22nd, 2004, 03:03 AM
#3
If the text is unicode formatted then there might be further complications. VB6 had StrConv() to sort that out, I don't know what the .net equiv would be.
I don't live here any more.
-
Apr 22nd, 2004, 03:11 AM
#4
Thread Starter
Junior Member
> asc("““")
once you type this in .net, it will automatically convert it to this right after typing it:
asc("""")
(you may try this if you want --> type a double quote in word then copy and paste it to the vb.net editor)
In effect, this will just give you the ascii for " which is 34.
-
Apr 22nd, 2004, 03:36 AM
#5
What about the VB6 immediate window? That should work.
?asc("““")
I don't live here any more.
-
Apr 22nd, 2004, 03:38 AM
#6
Thread Starter
Junior Member
what's a vb6 immediate window? im working on vb.net. forgive my ignorance on the terms, im kinda new to this
-
Apr 22nd, 2004, 06:57 AM
#7
Frenzied Member
he must mean the vb6.net version lol just kidding (couldn't resist)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|