Advertisement
2002VB String Manipulation #19671

Quotes in Strings

If you ever wanted to have a string with quotes inside this is a handy tip.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
To use quotes within strings. ie.<BR>
<b>Call me "Bob" OK</b><br>
<br>
This is hard to define within vb as quotes define the start and end of a string so:<br>
<b>talk = "Call me "Bob" OK"</b><br>
<br>
wont work. You can get around this by usings its ascii value (Chr(34) is equivalent to a quote) however there is an easier way, using double and triple quote marks.<br>
<br>
A double quote within a text string will add a quote into the text so<br>
<b>MsgBox "Hello ""Bob""!"</b><br>
<br>
Will display<br>
<b>Hello "Bob"!</b><br>
<br>
This also works at the start of a string so<br>
<b>MsgBox """Bob"""</b><br>
<br>
Will display<br>
<b>"Bob"</b><br><br><br>
This is a simple tip but will save you alot of effort.
Komentar Asli (3)
Dipulihkan dari Wayback Machine