comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Comparison Operators for Strings
Date: Tue, 25 Aug 2009 18:45:46 -0700 (PDT)
Date: 2009-08-25T18:45:46-07:00	[thread overview]
Message-ID: <786229e2-708e-46a4-85bb-2c6eb2d9e9bf@y10g2000prf.googlegroups.com> (raw)
In-Reply-To: al0lm.160236$zq1.8881@newsfe22.iad

On Aug 25, 6:37 pm, "Steve D" <nospam_steve...@comcast.net> wrote:
> "Rick" <rickdu...@gmail.com> wrote in message
>
> news:59ccf9ff-86ea-4179-8be3-a7f99218eeb5@q40g2000prh.googlegroups.com...
>
> > How do the comparison operators for Strings (Fixed-length, Unbounded,
> > whatever) actually work?  I am using Unbounded_String at the moment
> > and in the LRM I find:
>
> > 83 Each of the functions "=", "<", ">", "<=", and ">=" returns the
> > same result as the corresponding String operation applied to the
> > String values given or represented by Left and Right.
>
> > I have checked LRM 2.6, 3.6.3, and A.4 to A.4.8 and I cannot find a
> > result for a corresponding String operation.
>
> > Where should I be looking?
>
> LRM 4.5.2 Relational Operators an Membership tests
> Paragraph (18)
>
> The type "String" is nothing special and is defined in System:
>
> type String is array(Positive range <>) of Character;
>    pragma Pack(String);
>
> You compare strings the same way as you can any other one dimensional array
> as described in 4.5.2(18)

Well, not *any* other one-dimensional array; the ordering operations
("<", "<=", ">", ">=") are defined only for one-dimensional arrays of
a *discrete* type (i.e. integer or enumeration; Character is an
enumeration type).  4.5.2(18) only applies to "=", by the way.  For
ordering operators, see 4.5.2(8-9) and 4.5.2(26).

                                     -- Adam



  reply	other threads:[~2009-08-26  1:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26  1:03 Comparison Operators for Strings Rick
2009-08-26  1:37 ` Steve D
2009-08-26  1:45   ` Adam Beneschan [this message]
2009-08-26 23:07     ` rickduley
replies disabled

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