Prev | Up | ____ | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help


3.6.3 String Types

Static Semantics
(1)
A one-dimensional array type whose component type is a character type is called a string type.
(2)
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:
(3)
       subtype Positive is Integer range 1 .. Integer'Last;
(4)
       type String is array(Positive range <>) of Character;
       type Wide_String is array(Positive range <>) of Wide_Character;

(5)
Examples
(6)
Examples of string objects:
(7)
       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)
(8)
       Ask_Twice  : String  := Question & Question;   --  constrained to (1..40)
       Ninety_Six : constant Roman   := "XCVI";      --  see 3.5.2 and 3.6

Prev | Up | ____ | Back | Forward
TOC -- / --.-- / --.--.-- | Index | Search | Syntax | Help

Ada WWW Home -- Email comments, additions, corrections, gripes, kudos, etc. to:

Magnus Kempe -- Magnus.Kempe@di.epfl.ch
Copyright statement
Page last generated: 95-03-12