Go to the first, previous, next, last section, table of contents.
Static Semantics
-
A one-dimensional array type whose component type is a character type is
called a string type.
-
There are two predefined string types, String and Wide_String, each
indexed by values of the predefined subtype Positive; these are declared
in the visible part of package Standard:
-
subtype Positive is Integer range 1 .. Integer'Last;
-
type String is array(Positive range <>) of Character;
type Wide_String is array(Positive range <>) of Wide_Character;
NOTES
-
(49) String literals, See section 2.6 String Literals, and See section 4.2 Literals, are defined for all
string types. The concatenation operator & is predefined for string
types, as for all nonlimited one-dimensional array types. The ordering
operators <, <=, >, and >= are predefined for string types, as for all
one-dimensional discrete array types; these ordering operators
correspond to lexicographic order, See section 4.5.2 Relational Operators and Membership Tests.
Examples
-
Examples of string objects:
-
Stars : String(1 .. 120) := (1 .. 120 => '*' );
Question : constant String := "How many characters?";
-- Question'First = 1, Question'Last = 20
-- Question'Length = 20 (the number of characters)
-
Ask_Twice : String := Question & Question;
-- constrained to (1..40)
Ninety_Six : constant Roman := "XCVI";
-- See section 3.5.2 Character Types, and See section 3.6 Array Types
Go to the first, previous, next, last section, table of contents.