comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: newbie question: the " character inside a string
Date: 2000/05/24
Date: 2000-05-24T00:00:00+00:00	[thread overview]
Message-ID: <8ggrm2$ein$1@nnrp1.deja.com> (raw)
In-Reply-To: 8ggcnp$83r$1@inf2.informatik.uni-stuttgart.de

In article <8ggcnp$83r$1@inf2.informatik.uni-stuttgart.de>,
  "Martin Tobisch" <tobiscmn@rupert.informatik.uni-stuttgart.de> wrote:

> what do i have to do if i want to include a " inside of a string?

I know you already got a RTFM answer, but most manuals I have seen don't
properly address string handling in Ada (it really ought to have its own
chapter) and the LRM seems like overkill for such a simple question.

There are two simple ways (I know of) to do this:

  1)  Catenate a quotation character to your string eg:

   Value : constant String := "The name is " & '"' &
Some_String_Variable & '"';


  2)  "Escape" the quotation character in the string literal with
another quotation character:

   Value : constant String "= The name is """ & Some_String_Variable &
"""";


If you are using emacs, you'll probably want to stick to method 2, since
method 1 throws off Ada-mode's colorization.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-05-24  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-24  0:00 newbie question: the " character inside a string Martin Tobisch
2000-05-24  0:00 ` Ted Dennison [this message]
2000-05-24  0:00   ` Robert Dewar
2000-05-24  0:00     ` Jeff Carter
2000-05-25  0:00   ` Geoff Bull
2000-05-24  0:00 ` Robert Dewar
2000-05-24  0:00 ` David C. Hoos, Sr.
2000-05-24  0:00 ` John English
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox