comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: newbie question: the " character inside a string
Date: 2000/05/24
Date: 2000-05-24T11:54:53+00:00	[thread overview]
Message-ID: <8ggfud$75b$1@hobbes2.crc.com> (raw)
In-Reply-To: 8ggcnp$83r$1@inf2.informatik.uni-stuttgart.de


Martin Tobisch <tobiscmn@rupert.informatik.uni-stuttgart.de> wrote in
message news:8ggcnp$83r$1@inf2.informatik.uni-stuttgart.de...
> hello everbody,
>
> i have a simple question :
>
> what do i have to do if i want to include a " inside of a string?
> for instance make the string: name="something"?
> can i write is as normal "name="something"" an ADA will ignore
> the inner "'s es as string delimiter and only look for the outest "'s es?
> or do i have to quote the " inside of a string with a special character?
>
Here is the relevant section of the Ada Reference Manual:

2.6 String Literals

1 A string_literal is formed by a sequence of graphic characters (possibly
none) enclosed between two quotation marks used as string brackets. They are
used to represent operator_symbols (see 6.1), values of a string type (see
4.2), and array subaggregates (see 4.3.3).

Syntax

2 string_literal ::= "{string_element}"
3 string_element ::= "" | non_quotation_mark_graphic_character

4 A string_element is either a pair of quotation marks (""), or a single
graphic_character other than a quotation mark.

Static Semantics

5 The sequence of characters of a string_literal is formed from the sequence
of string_elements between the bracketing quotation marks, in the given
order, with a string_element that is "" becoming a single quotation mark in
the sequence of characters, and any other string_element being reproduced in
the sequence.
6 A null string literal is a string_literal with no string_elements between
the quotation marks.

NOTES

7 5 An end of line cannot appear in a string_literal.

Examples

8 Examples of string literals:

9 "Message of the day:"

""                           -- a null string literal
" "   "A"   """"             -- three string literals of length 1

"Characters such as $, %, and } are allowed in string literals"


> thanks for any help
>
> Greetings MArtin Tobisch
>
>
>






  parent 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 ` John English
2000-05-24  0:00 ` David C. Hoos, Sr. [this message]
2000-05-24  0:00 ` Robert Dewar
2000-05-24  0:00 ` Ted Dennison
2000-05-24  0:00   ` Robert Dewar
2000-05-24  0:00     ` Jeff Carter
2000-05-25  0:00   ` Geoff Bull
replies disabled

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