That’s not entirely true.
(Adding in your own "+"
or "&"
operators to the following…)
Package Pascal_String with Pure is
Subtype Byte is Interfaces.Unsigned_8;
Type String is private;
-- All the manipulation functions + create.
Function "+"( Input : Standard.String ) return String
with Pre => Input'Length in Byte'Range;
Function "+"(Input : String) return Standard.String;
Private
Type String is record
Length : Byte:= 0;
Text : Standard.String(1..255):= (others => ASCII.NUL);
end record
with Size => 256 * Byte'Size;
-- Convert to/from Internal.String via unchecked conversion.
Function "+"( Input : Standard.String ) return String is
( Length => Byte(Input'Length),
Text => Input & (Input'Length+1..256 => ASCII.NUL)
);
Function "+"(Input : String) return Standard.String is
( Input.Text(1..Input.Length) );
End_Pascal_String;