Home All Groups Group Topic Archive Search About

special character inside a string

Author
13 Apr 2005 8:03 AM
newbie
Hi
How do i put a special character like " in a string?

Author
13 Apr 2005 8:06 AM
Darren Barrick
Find the ascii char and use chr(charNo)

for example return is chr(13) and line feed is chr(10) (i think). I don't
know what " is off the top of my head but it should be east enough to find
out :)

Show quoteHide quote
"newbie" <new***@discussions.microsoft.com> wrote in message
news:6CEFD285-E5C5-4D7E-BD4A-3E3C8A61AA72@microsoft.com...
> Hi
> How do i put a special character like " in a string?
Author
13 Apr 2005 8:35 AM
Larry Lard
newbie wrote:
> Hi
> How do i put a special character like " in a string?

' Use "" to put a " in a string literal:
Dim s As String = "This string contains a quote mark "" <-- there it
is"
' Or you might prefer:
Dim t As String = "This string contains a quote mark " & Chr(34) & "
<-- there it is"

--
Larry Lard
Replies to group please
Author
13 Apr 2005 8:36 AM
Cor Ligthert
Newbie,

With a double "

"""" is one "

This is the only exception for the rest just the character.

I hope this helps,

Cor
Author
13 Apr 2005 8:37 AM
Mattias Sjögren
>How do i put a special character like " in a string?

You double up the quote, so the string

foo "bar"

is written as

"foo ""bar"""

Any other special characters you need?



Mattias

--
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
13 Apr 2005 8:39 AM
Herfried K. Wagner [MVP]
"newbie" <new***@discussions.microsoft.com> schrieb:
> How do i put a special character like " in a string?

Encode each double quote character with two consecutive double quote
characters:

\\\
MsgBox("He said: ""Hello World!""")
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
13 Apr 2005 1:48 PM
Chris
instr(string1,"""")

Show quoteHide quote
"newbie" <new***@discussions.microsoft.com> wrote in message
news:6CEFD285-E5C5-4D7E-BD4A-3E3C8A61AA72@microsoft.com...
> Hi
> How do i put a special character like " in a string?