DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Wide_Characters.Handling

Classification and case conversion of Wide_Character by Unicode's general categories (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

Ada.Wide_Wide_Characters.Handling's classifications and simple mappings for the Basic Multilingual Plane; a mapping that would leave the plane leaves the character as it is. Its bodies are proved (test/programs/prove/library-ada-wide_characters-handling).

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

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

Declared interface:

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

API 002

Category (declaration) — (Unicode's general category of a character)

Declared interface:

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

API 003

Is_Control (declaration) — A control character (Cc)

Declared interface:

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

API 004

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

Declared interface:

function Is_Letter (Item : 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) — A lower-case letter (Ll)

Declared interface:

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

API 006

Is_Upper (declaration) — An upper-case letter (Lu)

Declared interface:

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

API 007

Is_Digit (declaration) — A decimal digit of any script (Nd)

Declared interface:

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

API 008

Is_Decimal_Digit (declaration) — A decimal digit of any script (Nd)

Declared interface:

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

API 009

Is_Hexadecimal_Digit (declaration) — A decimal digit of any script (Nd)

Declared interface:

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

API 010

Is_Alphanumeric (declaration) — A decimal digit of any script (Nd)

Declared interface:

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

API 011

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

Declared interface:

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

API 012

Is_Mark (declaration) — A combining mark (Mn, Mc)

Declared interface:

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

API 013

Is_Other_Format (declaration) — A format character (Cf)

Declared interface:

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

API 014

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

Declared interface:

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

API 015

Is_Space (declaration) — A space separator (Zs)

Declared interface:

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

API 016

Is_NFKC (declaration) — Whether Item can be in a string normalized to Unicode's form KC.

Declared interface:

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

API 017

Is_Graphic (declaration) — A graphic character (RM 2.1): not a control, private-use or surrogate character, not a line or paragraph separator, and not the last two positions of a plane.

Declared interface:

function Is_Graphic (Item : 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_Character'Pos (Item) mod 16#1_0000# < 16#FFFE#);

API 018

Is_Special (declaration) — A graphic character (RM 2.1): not a control, private-use or surrogate character, not a line or paragraph separator, and not the last two positions of a plane.

Declared interface:

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

API 019

To_Upper (declaration) — The simple upper-case mapping of Item, else Item (as for one outside the plane)

Declared interface:

function To_Upper (Item : Wide_Character) return Wide_Character is
  (if Verada.Strings.Unicode.Simple_Upper (Wide_Character'Pos (Item)) <= 16#FFFF#
   then Wide_Character'Val (Verada.Strings.Unicode.Simple_Upper (Wide_Character'Pos (Item)))
   else Item);

API 020

To_Lower (declaration) — The simple lower-case mapping of Item, else Item.

Declared interface:

function To_Lower (Item : Wide_Character) return Wide_Character is
  (if Verada.Strings.Unicode.Simple_Lower (Wide_Character'Pos (Item)) <= 16#FFFF#
   then Wide_Character'Val (Verada.Strings.Unicode.Simple_Lower (Wide_Character'Pos (Item)))
   else Item);

API 021

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

Declared interface:

function To_Basic (Item : Wide_Character) return Wide_Character is
  (if Verada.Strings.Unicode.Basic (Wide_Character'Pos (Item)) <= 16#FFFF#
   then Wide_Character'Val (Verada.Strings.Unicode.Basic (Wide_Character'Pos (Item)))
   else Item);

API 022

Is_Basic (declaration) — A letter that To_Basic leaves as it is and that has no compatibility decomposition (not 'ª' nor the ligature 'fi')

Declared interface:

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

API 023

To_Upper (declaration) — A letter that To_Basic leaves as it is and that has no compatibility decomposition (not 'ª' nor the ligature 'fi')

Declared interface:

function To_Upper (Item : Wide_String) return 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) — A letter that To_Basic leaves as it is and that has no compatibility decomposition (not 'ª' nor the ligature 'fi')

Declared interface:

function To_Lower (Item : Wide_String) return 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) — A letter that To_Basic leaves as it is and that has no compatibility decomposition (not 'ª' nor the ligature 'fi')

Declared interface:

function To_Basic (Item : Wide_String) return 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)));