lib/string-classify.x
Byte classification for canonical strings.
Primary API
| Function | Summary |
|---|---|
String.contains_digit | Reports whether str contains a decimal digit. |
String.is_alnum | Reports whether every byte of nonempty s is alphanumeric. |
String.is_alnum_under | Reports whether nonempty s is alphanumeric or underscore. |
String.is_alpha | Reports whether every byte of nonempty s is alphabetic. |
String.is_alpha_under | Reports whether every byte of nonempty s is alphabetic or underscore. |
String.is_digit | Reports whether every byte of nonempty s is a decimal digit. |
String.is_identifier | Reports whether s is a C identifier under C character classes. |
String.is_lower | Reports whether every byte of nonempty s is lower-case. |
String.is_lower_under | Reports whether every byte of nonempty s is lower-case or underscore. |
String.is_space | Reports whether every byte of nonempty s is whitespace. |
String.is_upper | Reports whether every byte of nonempty s is upper-case. |
String.is_upper_under | Reports whether every byte of nonempty s is upper-case or underscore. |
String
String.contains_digit
int String.contains_digit(String str)
Reports whether str contains a decimal digit.
A null or empty String returns false.
Source: lib/string-classify.x:19
String.is_alnum
int String.is_alnum(String s)
Reports whether every byte of nonempty s is alphanumeric.
Source: lib/string-classify.x:53
String.is_alnum_under
int String.is_alnum_under(String s)
Reports whether nonempty s is alphanumeric or underscore.
Source: lib/string-classify.x:58
String.is_alpha
int String.is_alpha(String s)
Reports whether every byte of nonempty s is alphabetic.
Source: lib/string-classify.x:38
String.is_alpha_under
int String.is_alpha_under(String s)
Reports whether every byte of nonempty s is alphabetic or underscore.
Source: lib/string-classify.x:43
String.is_digit
int String.is_digit(String s)
Reports whether every byte of nonempty s is a decimal digit.
Source: lib/string-classify.x:48
String.is_identifier
int String.is_identifier(String s)
Reports whether s is a C identifier under C character classes.
The first byte must be alphabetic or underscore; later bytes may also be
decimal digits. A null or empty String returns false.
Source: lib/string-classify.x:66
String.is_lower
int String.is_lower(String s)
Reports whether every byte of nonempty s is lower-case.
Source: lib/string-classify.x:81
String.is_lower_under
int String.is_lower_under(String s)
Reports whether every byte of nonempty s is lower-case or underscore.
Source: lib/string-classify.x:86
String.is_space
int String.is_space(String s)
Reports whether every byte of nonempty s is whitespace.
Source: lib/string-classify.x:76
String.is_upper
int String.is_upper(String s)
Reports whether every byte of nonempty s is upper-case.
Source: lib/string-classify.x:91
String.is_upper_under
int String.is_upper_under(String s)
Reports whether every byte of nonempty s is upper-case or underscore.
Source: lib/string-classify.x:96
Design notes
Predicates classify unsigned bytes with Cās current locale. The canonical
empty String is NULL and every predicate reports false for it. No
predicate allocates or mutates its input.
Tests and examples
make verify (unittest/test-string-classify.x).