strings_maps¶
Dependencies¶
None
Description¶
This package provides types and functions for manipulating character sets.
It is a clone of the Ada‘95 package Ada.Strings.Maps
.
Types¶
-
strings_maps.
character_set
¶ Array of boolean flag bits indexed by
character
.
-
strings_maps.
character_range
¶ Inclusive range of characters within the Latin-1 set.
-
strings_maps.
character_ranges
¶ Collection of character ranges.
-
strings_maps.
character_mapping
¶ Mapping from one character to another.
Subprograms¶
-
strings_maps.
to_set
(ranges : character_ranges) → character_set¶ - Convert ranges to a character set
Parameters: - ranges (character_ranges) – List of character ranges in the set
Returns: A character set with the requested ranges.
-
strings_maps.
to_set
(span : character_range) → character_set¶ - Convert range to a character set
Parameters: - span (character_range) – Range to build into character set
Returns: A character set with the requested range.
-
strings_maps.
to_ranges
(set : character_set) → character_ranges¶ - Convert a character set into a list of ranges
Parameters: - set (character_set) – Character set to extract ranges from
Returns: All contiguous ranges in the set.
-
strings_maps.
"-"
(left : character_set; right : character_set) → character_set¶ - Difference between to character sets
Parameters: - left (character_set) – Set to subtract from
- right (character_set) – Set to subtract from left
Returns: All characters in left not in right.
-
strings_maps.
is_in
(element : character; set : character_set) → boolean¶ - Test if a character is part of a character set
Parameters: - element (character) – Character to test for
- set (character_set) – Character set to test membership in
Returns: true if element is in the set.
-
strings_maps.
is_subset
(elements : character_set; set : character_set) → boolean¶ - Test if a character set is a subset of a larget set
Parameters: - elements (character_set) – Character set to test for
- set (character_set) – Character set to test membership in
Returns: true if elements are in the set.
-
strings_maps.
to_set
(sequence : character_sequence) → character_set¶ - Convert a character sequence into a set.
Parameters: - sequence (character_sequence) – String of characters to build into a set
Returns: A character set with all unique characters from sequence.
-
strings_maps.
to_set
(singleton : character) → character_set¶ - Convert a character into a set.
Parameters: - singleton (character) – Character to include in the set
Returns: A character set with one single character as its member.
-
strings_maps.
to_sequence
(set : character_set) → character_sequence¶ - Convert a character set into a sequence string
Parameters: - set (character_set) – Character set to convert
Returns: A sequence string with each character from the set.
-
strings_maps.
value
(cmap : character_mapping; element : character) → character¶ - Look up the mapping for a character.
Parameters: - cmap (character_mapping) – Map associating Latin-1 characters with a substitute
- element (character) – Character to lookup in the map
Returns: The mapped value of the element character.
-
strings_maps.
to_mapping
(from : character_sequence; to_seq : character_sequence) → character_mapping¶ - Create a mapping from two sequences.
Parameters: - from (character_sequence) – Sequence string to use for map indices
- to_seq (character_sequence) – Sequence string to use from map values
Returns: A new map to convert characters in the from sequence into the to_seq.
-
strings_maps.
to_domain
(cmap : character_mapping) → character_sequence¶ - Return the from sequence for a mapping.
Parameters: - cmap (character_mapping) – Character map to extract domain from
Returns: The characters used to map from.
-
strings_maps.
to_range
(cmap : character_mapping) → character_sequence¶ - Return the to_seq sequence for a mapping.
Parameters: - cmap (character_mapping) – Character map to extract range from
Returns: The characters used to map into.