On this page
Ada.Strings.Wide_Wide_Fixed
Searching, trimming and padding of Wide_Wide_String (RM A.4.8).
Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.
Availability and ownership
The operations Verada's Ada.Strings.Fixed has, with the same contracts, for Wide_Wide_String; results are indexed from 1. Its bodies are proved (test/programs/prove/library-ada-strings-wide_wide_fixed).
A client proof uses these contracts without proving the body again (see library assurance). Global => null excludes package-global effects, not changes made through an in out argument.
Import and instantiate
with Ada.Strings.Wide_Wide_Fixed;import Ada.Strings.Wide_Wide_Fixed;
A Vibe module imports this unit's names with from Ada.Strings.Wide_Wide_Fixed import Name; see library use across syntaxes. In Varc, keep each name's declared spelling and write & on arguments the call changes.
Contract and lifecycle reading
A Pre condition is the caller's obligation; a Post is what a normal return guarantees. What a postcondition does not state, a client cannot assume. Ghost functions are for contracts and ghost code. The family guide describes copying, lifetime, order and cost.
API 001
Index (declaration) — The first (or, Backward, the last) place where a nonempty Pattern occurs in Source, or 0; the postcondition says the result matches and that no place matches when it is 0.
Declared interface:
function Index (Source : Wide_Wide_String; Pattern : Wide_Wide_String; Going : Direction := Forward) return Natural
with Global => null,
Pre => Pattern'Length > 0,
Post => (if Index'Result = 0
then (if Pattern'Length <= Source'Length
then (for all I in Source'First .. Source'Last - (Pattern'Length - 1) => Source (I .. I + (Pattern'Length - 1)) /= Pattern))
else Index'Result in Source'Range
and then Index'Result <= Source'Last - (Pattern'Length - 1)
and then Source (Index'Result .. Index'Result + (Pattern'Length - 1)) = Pattern);API 002
Index_Non_Blank (declaration) — The first (or last) character of Source that is not Wide_Wide_Space, or 0 when every one is.
Declared interface:
function Index_Non_Blank (Source : Wide_Wide_String; Going : Direction := Forward) return Natural
with Global => null,
Post => (if Index_Non_Blank'Result = 0
then (for all I in Source'Range => Source (I) = Wide_Wide_Space)
else Index_Non_Blank'Result in Source'Range
and then Source (Index_Non_Blank'Result) /= Wide_Wide_Space
and then (if Going = Forward
then (for all I in Source'Range => (if I < Index_Non_Blank'Result then Source (I) = Wide_Wide_Space))
else (for all I in Source'Range => (if I > Index_Non_Blank'Result then Source (I) = Wide_Wide_Space))));API 003
Trim (declaration) — Source without its leading spaces, trailing spaces or both, indexed from 1.
Declared interface:
function Trim (Source : Wide_Wide_String; Side : Trim_End) return Wide_Wide_String
with Global => null,
Post => Trim'Result'Length <= Source'Length;API 004
Head (declaration) — The first Count characters of Source, padded on the right with Pad.
Declared interface:
function Head (Source : Wide_Wide_String; Count : Natural; Pad : Wide_Wide_Character := Wide_Wide_Space) return Wide_Wide_String
with Global => null,
Post => Head'Result'Length = Count;API 005
Tail (declaration) — The last Count characters of Source, padded on the left with Pad.
Declared interface:
function Tail (Source : Wide_Wide_String; Count : Natural; Pad : Wide_Wide_Character := Wide_Wide_Space) return Wide_Wide_String
with Global => null,
Post => Tail'Result'Length = Count;API 006
"*" (declaration) — Left copies of a Wide_Wide_Character.
Declared interface:
function "*" (Left : Natural; Right : Wide_Wide_Character) return Wide_Wide_String
with Global => null,
Post => "*"'Result'Length = Left;