comp.lang.ada
 help / color / mirror / Atom feed
* Comparison Operators for Strings
@ 2009-08-26  1:03 Rick
  2009-08-26  1:37 ` Steve D
  0 siblings, 1 reply; 4+ messages in thread
From: Rick @ 2009-08-26  1:03 UTC (permalink / raw)


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?

--------------------------------------------
Rick Duley
North Perth,
Western Australia
http://rickduley.webs.com
--------------------------------------------



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comparison Operators for Strings
  2009-08-26  1:03 Comparison Operators for Strings Rick
@ 2009-08-26  1:37 ` Steve D
  2009-08-26  1:45   ` Adam Beneschan
  0 siblings, 1 reply; 4+ messages in thread
From: Steve D @ 2009-08-26  1:37 UTC (permalink / raw)


"Rick" <rickduley@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)

Regards,
Steve

> --------------------------------------------
> Rick Duley
> North Perth,
> Western Australia
> http://rickduley.webs.com
> --------------------------------------------





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comparison Operators for Strings
  2009-08-26  1:37 ` Steve D
@ 2009-08-26  1:45   ` Adam Beneschan
  2009-08-26 23:07     ` rickduley
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Beneschan @ 2009-08-26  1:45 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comparison Operators for Strings
  2009-08-26  1:45   ` Adam Beneschan
@ 2009-08-26 23:07     ` rickduley
  0 siblings, 0 replies; 4+ messages in thread
From: rickduley @ 2009-08-26 23:07 UTC (permalink / raw)


Thanks fellas.  That's solved the problem but ...

This is purely rhetorical, why doesn't the LRM say to look there?
It'd save people like me a bit of time :)

--------------------------------------------
Rick Duley
North Perth,
Western Australia
--------------------------------------------



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-26 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-26  1:03 Comparison Operators for Strings Rick
2009-08-26  1:37 ` Steve D
2009-08-26  1:45   ` Adam Beneschan
2009-08-26 23:07     ` rickduley

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