DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Wide_Wide_Characters.Handling

Classification and case conversion of all of Unicode (RM A.3.5).

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 classifications are by Unicode 16.0.0's general categories, the case conversions Unicode's simple mappings (one character for one). Every function but the string conversions is an expression function: of a Latin-1 character a proof sees the exact answer, of any other a call of the run time's tables. Is_Basic and To_Basic are of letters, as Ada.Characters.Handling's are. Category is Verada's addition.

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.Wide_Wide_Characters.Handling;
import Ada.Wide_Wide_Characters.Handling;

A Vibe module imports this unit's names with from Ada.Wide_Wide_Characters.Handling 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

Character_Set_Version (declaration) — The version of Unicode the classifications and conversions follow, "Unicode 16.0.0".

Declared interface:

function Character_Set_Version return String is ("Unicode 16.0.0");

API 002

Category (declaration) — Verada's addition: Unicode's general category of a character, a Verada.Strings.Unicode.General_Category.

Declared interface:

function Category (Item : Wide_Wide_Character) return Verada.Strings.Unicode.General_Category is
  (Verada.Strings.Unicode.Category (Wide_Wide_Character'Pos (Item)));

API 003

Is_Control (declaration) — Recognize a control character (general category Cc).

Declared interface:

function Is_Control (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Cc);

API 004

Is_Letter (declaration) — Recognize a letter (Lu, Ll, Lt, Lm, Lo) or a letter number (Nl).

Declared interface:

function Is_Letter (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) in Verada.Strings.Unicode.Lu .. Verada.Strings.Unicode.Lo | Verada.Strings.Unicode.Nl);

API 005

Is_Lower (declaration) — Recognize a lower-case letter (Ll).

Declared interface:

function Is_Lower (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Ll);

API 006

Is_Upper (declaration) — Recognize an upper-case letter (Lu).

Declared interface:

function Is_Upper (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Lu);

API 007

Is_Digit (declaration) — Recognize a decimal digit of any script (Nd), not only '0' .. '9'.

Declared interface:

function Is_Digit (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Nd);

API 008

Is_Decimal_Digit (declaration) — A renaming of Is_Digit.

Declared interface:

function Is_Decimal_Digit (Item : Wide_Wide_Character) return Boolean renames Is_Digit;

API 009

Is_Hexadecimal_Digit (declaration) — Recognize a decimal digit or one of 'A' .. 'F' and 'a' .. 'f'.

Declared interface:

function Is_Hexadecimal_Digit (Item : Wide_Wide_Character) return Boolean is
  (Is_Digit (Item) or else Item in 'A' .. 'F' | 'a' .. 'f');

API 010

Is_Alphanumeric (declaration) — Recognize a letter or a decimal digit.

Declared interface:

function Is_Alphanumeric (Item : Wide_Wide_Character) return Boolean is
  (Is_Letter (Item) or else Is_Digit (Item));

API 011

Is_Line_Terminator (declaration) — Recognize a line or paragraph separator (Zl, Zp) or one of LF, VT, FF, CR and NEL.

Declared interface:

function Is_Line_Terminator (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) in Verada.Strings.Unicode.Zl | Verada.Strings.Unicode.Zp
   or else Wide_Wide_Character'Pos (Item) in 10 .. 13 | 16#85#);

API 012

Is_Mark (declaration) — Recognize a combining mark (Mn, Mc).

Declared interface:

function Is_Mark (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) in Verada.Strings.Unicode.Mn | Verada.Strings.Unicode.Mc);

API 013

Is_Other_Format (declaration) — Recognize a format character (Cf), such as the soft hyphen.

Declared interface:

function Is_Other_Format (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Cf);

API 014

Is_Punctuation_Connector (declaration) — Recognize a connector punctuation (Pc), such as '_'.

Declared interface:

function Is_Punctuation_Connector (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Pc);

API 015

Is_Space (declaration) — Recognize a space separator (Zs); tabs and line ends are not.

Declared interface:

function Is_Space (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) = Verada.Strings.Unicode.Zs);

API 016

Is_NFKC (declaration) — Recognize a character that normalization form KC leaves as it is.

Declared interface:

function Is_NFKC (Item : Wide_Wide_Character) return Boolean is
  (Verada.Strings.Unicode.Is_NFKC (Wide_Wide_Character'Pos (Item)));

API 017

Is_Graphic (declaration) — Recognize a graphic character: not a control, private-use or surrogate code point, not a line or paragraph separator, not the last two positions of a plane.

Declared interface:

function Is_Graphic (Item : Wide_Wide_Character) return Boolean is
  (Category (Item) not in Verada.Strings.Unicode.Zl | Verada.Strings.Unicode.Zp | Verada.Strings.Unicode.Cc
                        | Verada.Strings.Unicode.Cs | Verada.Strings.Unicode.Co
   and then Wide_Wide_Character'Pos (Item) mod 16#1_0000# < 16#FFFE#);

API 018

Is_Special (declaration) — Recognize a graphic character that is neither a letter nor a decimal digit.

Declared interface:

function Is_Special (Item : Wide_Wide_Character) return Boolean is
  (Is_Graphic (Item) and then not Is_Alphanumeric (Item));

API 019

To_Upper (declaration) — Unicode's simple upper-case mapping of a character (one character for one), else the character.

Declared interface:

function To_Upper (Item : Wide_Wide_Character) return Wide_Wide_Character is
  (Wide_Wide_Character'Val (Verada.Strings.Unicode.Simple_Upper (Wide_Wide_Character'Pos (Item))));

API 020

To_Lower (declaration) — Unicode's simple lower-case mapping of a character, else the character.

Declared interface:

function To_Lower (Item : Wide_Wide_Character) return Wide_Wide_Character is
  (Wide_Wide_Character'Val (Verada.Strings.Unicode.Simple_Lower (Wide_Wide_Character'Pos (Item))));

API 021

To_Basic (declaration) — The basic letter of a letter with diacritical marks ('A' for 'Å' and 'Ǻ'), else the character.

Declared interface:

function To_Basic (Item : Wide_Wide_Character) return Wide_Wide_Character is
  (Wide_Wide_Character'Val (Verada.Strings.Unicode.Basic (Wide_Wide_Character'Pos (Item))));

API 022

Is_Basic (declaration) — Recognize a letter To_Basic leaves as it is and that has no compatibility decomposition.

Declared interface:

function Is_Basic (Item : Wide_Wide_Character) return Boolean is
  (Is_Letter (Item) and then To_Basic (Item) = Item
   and then not Verada.Strings.Unicode.Has_Compatibility_Decomposition (Wide_Wide_Character'Pos (Item)));

API 023

To_Upper (declaration) — Each character's upper case, the result indexed from 1 with the argument's length, as the postcondition states.

Declared interface:

function To_Upper (Item : Wide_Wide_String) return Wide_Wide_String
  with Global => null,
       Post => To_Upper'Result'First = 1 and then To_Upper'Result'Length = Item'Length
               and then (for all I in 1 .. Item'Length => To_Upper'Result (I) = To_Upper (Item (I - 1 + Item'First)));

API 024

To_Lower (declaration) — Each character's lower case, the result indexed from 1 with the argument's length, as the postcondition states.

Declared interface:

function To_Lower (Item : Wide_Wide_String) return Wide_Wide_String
  with Global => null,
       Post => To_Lower'Result'First = 1 and then To_Lower'Result'Length = Item'Length
               and then (for all I in 1 .. Item'Length => To_Lower'Result (I) = To_Lower (Item (I - 1 + Item'First)));

API 025

To_Basic (declaration) — Each character's basic letter, the result indexed from 1 with the argument's length, as the postcondition states.

Declared interface:

function To_Basic (Item : Wide_Wide_String) return Wide_Wide_String
  with Global => null,
       Post => To_Basic'Result'First = 1 and then To_Basic'Result'Length = Item'Length
               and then (for all I in 1 .. Item'Length => To_Basic'Result (I) = To_Basic (Item (I - 1 + Item'First)));