A.4.10 String Comparison
Static Semantics
{
AI12-0414-1}
function Ada.Strings.Equal_Case_Insensitive (Left, Right : String)
return Boolean
with;
pragma Pure
(Ada.Strings.Equal_Case_Insensitive);
{
AI12-0263-1}
{
AI12-0450-1}
Returns True if the strings consist of the same sequence of characters
after applying locale-independent simple case folding, as defined by
documents referenced in
the note in Clause
2 1 of ISO/IEC
10646:
2020 2011.
Otherwise, returns False. This function uses the same method as is used
to determine whether two identifiers are the same.
Discussion: {
AI05-0286-1}
For String, this is equivalent to converting to lower case and comparing.
Not so for other string types. For Wide_Strings and Wide_Wide_Strings,
note that this result is a more accurate comparison than converting the
strings to lower case and comparing the results; it is possible that
the lower case conversions are the same but this routine will report
the strings as different. Additionally, Unicode says that the result
of this function will never change for strings made up solely of defined
code points; there is no such guarantee for case conversion to lower
case.
{
AI12-0263-1}
The “documents referenced” means Unicode,
Chapter 4 (specifically, section 4.2 — Case). See the Implementation
Notes in 2.3 for a source for machine-readable
definitions of these properties.
with Ada.Strings.Equal_Case_Insensitive;
function Ada.Strings.Fixed.Equal_Case_Insensitive
(Left, Right : String)
return Boolean
renames Ada.Strings.Equal_Case_Insensitive;
{
AI12-0241-1}
{
AI12-0302-1}
generic
with package Bounded
is
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
function Ada.Strings.Bounded.Equal_Case_Insensitive
(Left, Right : Bounded.Bounded_String)
return Boolean
;
with pragma Preelaborate
, Nonblocking, Global => in out synchronized(Ada.Strings.Bounded.Equal_Case_Insensitive);
Equivalent to Strings.Equal_Case_Insensitive
(Bounded.To_String (Left), Bounded.To_String (Right));
{
AI12-0241-1}
{
AI12-0302-1}
function Ada.Strings.Unbounded.Equal_Case_Insensitive
(Left, Right : Unbounded_String)
return Boolean
;
with pragma Preelaborate
, Nonblocking, Global => in out synchronized(Ada.Strings.Unbounded.Equal_Case_Insensitive);
Equivalent to Strings.Equal_Case_Insensitive
(To_String (Left), To_String (Right));
{
AI12-0414-1}
function Ada.Strings.Less_Case_Insensitive (Left, Right : String)
return Boolean
with;
pragma Pure
(Ada.Strings.Less_Case_Insensitive);
Performs a lexicographic
comparison of strings Left and Right, converted to lower case.
with Ada.Strings.Less_Case_Insensitive;
function Ada.Strings.Fixed.Less_Case_Insensitive
(Left, Right : String)
return Boolean
renames Ada.Strings.Less_Case_Insensitive;
{
AI12-0241-1}
{
AI12-0302-1}
generic
with package Bounded
is
new Ada.Strings.Bounded.Generic_Bounded_Length (<>);
function Ada.Strings.Bounded.Less_Case_Insensitive
(Left, Right : Bounded.Bounded_String)
return Boolean
;
with pragma Preelaborate
, Nonblocking, Global => in out synchronized(Ada.Strings.Bounded.Less_Case_Insensitive);
Equivalent to Strings.Less_Case_Insensitive
(Bounded.To_String (Left), Bounded.To_String (Right));
{
AI12-0241-1}
{
AI12-0302-1}
function Ada.Strings.Unbounded.Less_Case_Insensitive
(Left, Right : Unbounded_String)
return Boolean
;
with pragma Preelaborate
, Nonblocking, Global => in out synchronized(Ada.Strings.Unbounded.Less_Case_Insensitive);
Equivalent to Strings.Less_Case_Insensitive
(To_String (Left), To_String (Right));
Extensions to Ada 2005
{
AI05-0001-1}
{
AI05-0286-1}
The Strings.Equal_Case_Insensitive, Strings.Fixed.Equal_Case_Insensitive,
Strings.Bounded.Equal_Case_Insensitive, Strings.Unbounded.Equal_Case_Insensitive,
Strings.Less_Case_Insensitive, Strings.Fixed.Less_Case_Insensitive, Strings.Bounded.Less_Case_Insensitive,
Strings.Unbounded.Less_Case_Insensitive functions are new.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe