How can I use a quote as a literal so it does get confused as not a literal?
Thanks!
Bob 10 3000
On Jun 5, 9:43 am, BobAchgill <BobAchg...@discussions.microsoft.com>
wrote:
How can I use a quote as a literal so it does get confused as not a literal?
Thanks!
Bob
Quotes can be escaped by doubling.
Dim s as String = "<img src=""image1.jpg"">"
"BobAchgill" <Bo********@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
How can I use a quote as a literal so it does get confused as not a
literal?
Thanks!
Bob
If you mean within a string, try something like this:
Label1.Text = "This displays a quotation mark = ""!"
The double quotes before the exclamation mark will display as a single
quote, part of the literal.
"pvdg42" wrote:
>
"BobAchgill" <Bo********@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
How can I use a quote as a literal so it does get confused as not a
literal?
Thanks!
Bob
If you mean within a string, try something like this:
Label1.Text = "This displays a quotation mark = ""!"
The double quotes before the exclamation mark will display as a single
quote, part of the literal.
True, but ersonally I prefer to use ControlChars.Quote and build the string
up as I find it easier to read
guy
So what would that look like in a literal string nested with variables? Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + " time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
"guy" wrote:
>
"pvdg42" wrote:
"BobAchgill" <Bo********@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
How can I use a quote as a literal so it does get confused as not a
literal?
>
Thanks!
>
Bob
If you mean within a string, try something like this:
Label1.Text = "This displays a quotation mark = ""!"
The double quotes before the exclamation mark will display as a single
quote, part of the literal.
True, but ersonally I prefer to use ControlChars.Quote and build the string
up as I find it easier to read
guy
BobAchgill wrote:
So what would that look like in a literal string nested with variables? Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + " time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
You have to put ControlChars.Quote outside of the string:
strMyString = "I am about to have a " & ControlChars.Quote & "COW" &
ControlChars.Quote & " for the " & Counter & " time!"
In my opinion, this is not easier to read than:
strMyString = "I am about to have a ""COW"" for the " & Counter & " time!"
--
Göran Andersson
_____ http://www.guffa.com
On Jun 6, 6:14 am, Göran Andersson <g...@guffa.comwrote:
BobAchgill wrote:
So what would that look like in a literal string nested with variables?Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + " time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
You have to put ControlChars.Quote outside of the string:
strMyString = "I am about to have a " & ControlChars.Quote & "COW" &
ControlChars.Quote & " for the " & Counter & " time!"
In my opinion, this is not easier to read than:
strMyString = "I am about to have a ""COW"" for the " & Counter & " time!"
--
Göran Andersson
_____http://www.guffa.com
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Thanks,
Seth Rowe
rowe_newsgroups wrote:
<snip using doubled quotation marks vs. ControlChars.Quote>
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Surely the compiler evaluates such things at compile-time? Or is that where
you're saying the performance hit comes?
Ugh! I just put
Dim a As Integer = CInt(1 / Math.Sin(0))
and it didn't complain until run-time. So it has a limit to what it'll try
to evaluate, e.g. it does complain about
Dim a As Integer = CInt(1 / 0)
"Constant expression not representable in type Integer".
Andrew
On Jun 6, 5:59 am, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Jun 6, 6:14 am, Göran Andersson <g...@guffa.comwrote:
BobAchgill wrote:
So what would that look like in a literal string nested with variables? Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + " time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
You have to put ControlChars.Quote outside of the string:
strMyString = "I am about to have a " & ControlChars.Quote & "COW" &
ControlChars.Quote & " for the " & Counter & " time!"
In my opinion, this is not easier to read than:
strMyString = "I am about to have a ""COW"" for the " & Counter & " time!"
--
Göran Andersson
_____http://www.guffa.com
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Thanks,
Seth Rowe
ControlChars.Quote is a constant so the compiler concatenates it a
compile time. Now the Counter variable, not being a constant, will
cause a concatenation at runtime, but there's not performance hit to
using ControlChars.Quote. I agree with Goran that using "" is easier
to read.
Chris
On 6 jun, 09:21, Chris Dunaway <dunaw...@gmail.comwrote:
On Jun 6, 5:59 am, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Jun 6, 6:14 am, Göran Andersson <g...@guffa.comwrote:
BobAchgill wrote:
So what would that look like in a literal string nested with variables? Like
this??
strMyString = "I am about to have a "COW" for the " + Counter + "time!"
strMyString = "I am about to have a ControlChars.Quote COW
ControlChars.Quote for the " + Counter + " time!"
Thanks! Bob
You have to put ControlChars.Quote outside of the string:
strMyString = "I am about to have a " & ControlChars.Quote & "COW" &
ControlChars.Quote & " for the " & Counter & " time!"
In my opinion, this is not easier to read than:
strMyString = "I am about to have a ""COW"" for the " & Counter & "time!"
--
Göran Andersson
_____http://www.guffa.com
Not to mention the minor performance hit for string concatenation for
using ControlChars.Quote
Thanks,
Seth Rowe
ControlChars.Quote is a constant so the compiler concatenates it a
compile time. Now the Counter variable, not being a constant, will
cause a concatenation at runtime, but there's not performance hit to
using ControlChars.Quote. I agree with Goran that using "" is easier
to read.
Chris- Ocultar texto de la cita -
- Mostrar texto de la cita -
Hi Bob
You can use quotes in this way:
Dim strCad as String = "I am about to have a ""COW"" for the " +
Counter + " time!"
Just using double quotes... Do I make myself clear?
"diAb0Lo" <ga********@gmail.comschrieb:
>Dim strCad as String = "I am about to have a ""COW"" for the " + Counter + " time!"
Just using double quotes... Do I make myself clear?
Yes, but I suggest to use '&' for string concatenation instead of '+'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sona |
last post by:
Hi,
What's the advantage/disadvantage of using a "const char*" over a
"char*" ? I read some place that char* are string literals that on some
machines are stored in a read only memory and cannot...
|
by: peridian |
last post by:
Hi,
I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code.
Most of the techniques I have seen for this involve complex use...
|
by: RC- |
last post by:
Hi everyone,
I have been searching and searching for an answer to this question using
Google and what not; I have not been able to find a "clear cut" answer.
OK, now the question:
I have a...
|
by: anton |
last post by:
Hi,
I want to replace all occourences of " by \" in a string.
But I want to leave all occourences of \" as they are.
The following should happen:
this I want " while I dont want this \"
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |