Utility Functions

Return to Contents

These are intended as helper functions for use with Satisfy combinators and the like when parsing ordinary strings.

generic
    Set : in Ada.Strings.Maps.Character_Set;
function In_Set
       (Element : in Character)
    return Boolean;
Tests whether a Character is present within the given Character_Set.
generic
    Set : in Ada.Strings.Maps.Character_Set;
function Not_In_Set
       (Element : in Character)
    return Boolean;
Tests whether a Character is not present within the given Character_Set.
function Is_Digit
       (Char : in Character)
    return Boolean;
Tests whether a Character is one of the digits 0 through 9.
function Is_Hex
       (Char : in Character)
    return Boolean;
Tests whether a Character is one of the digits 0 through 9 or one of the letters A through F, case insensitive.
function Is_Letter
       (Char : in Character)
    return Boolean;
Tests whether a Character is one of the letters A through Z, case insensitive.
function Is_Alphanumeric
       (Char : in Character)
    return Boolean;
Tests whether a Character is one of the digits 0 through 9 or one of the letters A through Z, case insensitive.
function Is_Punctuation
       (Char : in Character)
    return Boolean;
Tests whether a Character is one of the punctuation characters ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ which annoyingly occupies several disjoint sections of ASCII.
function Is_ASCII
       (Char : in Character)
    return Boolean;
Tests whether a Character is in the lower half of the ASCII character set.
function Is_Extended_ASCII
       (Char : in Character)
    return Boolean;
Tests whether a Character is in the upper half of the ASCII character set.
function Is_Space
       (Char : in Character)
    return Boolean;
Tests whether a Character is a space.
function Is_Linespace
       (Char : in Character)
    return Boolean;
Tests whether a Character is a space or horizontal tab.
function Is_End_Of_Line
       (Char : in Character)
    return Boolean;
Tests whether a Character is a linefeed or carriage return.
function Is_Whitespace
       (Char : in Character)
    return Boolean;
Tests whether a Character is a space, horizontal tab, linefeed, or carriage return.
function Not_Whitespace
       (Char : in Character)
    return Boolean;
Tests whether a Character is not a space, horizontal tab, linefeed, or carriage return.