stdlib_ascii
moduleThe stdlib_ascii
module provides procedures for handling and manipulating
intrinsic character variables and constants.
stdlib_ascii
NUL
Null character
SOH
Start Of Heading Character
STX
Start Of Text character
ETX
End Of Text character
EOT
End Of Transmission character
ENQ
Enquiry character
ACK
Acknowledge character
BEL
Bell character
BS
Backspace character
TAB
Horizontal Tab character
LF
Line Feed character
VT
Vertical Tab character
FF
Form Feed character
CR
Carriage Return character
SO
Shift Out character
SI
Shift In character
DLE
Data Link Escape character
DC1
Device Control 1 character
DC2
Device Control 2 character
DC3
Device Control 3 character
DC4
Device Control 4 character
NAK
Negative Acknowledge character
SYN
Synchronous Idle character
ETB
End of Transmission Block character
CAN
Cancel character
EM
End of Medium character
SUB
Substitute character
ESC
Escape character
FS
File separator character
GS
Group Separator character
RS
Record Separator character
US
Unit separator character
DEL
Delete character
fullhex_digits
All the hexadecimal digits (0-9, A-F, a-f)
hex_digits
All the numerical and uppercase hexadecimal digits (0-9, A-F)
lowerhex_digits
All the numerical and lowercase hexadecimal digits (0-9, a-f)
digits
base 10 digits (0-9)
octal_digits
base 8 digits (0-7)
letters
Uppercase and lowercase letters of the english alphabet (A-Z, a-z)
uppercase
Uppercase english albhabets (A-Z)
lowercase
Lowercase english albhabets (a-z)
whitespace
All the ascii whitespace characters (space, horizontal tab, vertical tab, carriage return, line feed, form feed)
stdlib_ascii
proceduresis_alpha
Experimental
Checks whether input character is an ASCII letter (A-Z, a-z).
res =
is_alpha (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_alphanum
Experimental
Checks whether input character is an ASCII letter or a number (A-Z, a-z, 0-9).
res =
is_alphanum (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_ascii
Experimental
Checks whether input character is in the ASCII character set i.e in the range 0-128.
res =
is_ascii (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_control
Experimental
Checks whether input character is a control character.
res =
is_control (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_digit
Experimental
Checks whether input character is a digit (0-9).
res =
is_digit (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_octal_digit
Experimental
Checks whether input character is an octal digit (0-7)
res =
is_octal_digit (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_hex_digit
Experimental
Checks whether input character is a hexadecimal digit (0-9, A-F, a-f).
res =
is_hex_digit (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_punctuation
Experimental
Checks whether input character is a punctuation character.
res =
is_punctuation (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_graphical
Experimental
Checks whether input character is a graphical character (printable other than the space character).
res =
is_graphical (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_printable
Experimental
Checks whether input character is a printable character (including the space character).
res =
is_printable (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_lower
Experimental
Checks whether input character is a lowercase ASCII letter (a-z).
res =
is_lower (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_upper
Experimental
Checks whether input character is an uppercase ASCII letter (A-Z).
res =
is_upper (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_white
Experimental
Checks whether input character is a whitespace character (which includes space, horizontal tab, vertical tab, carriage return, linefeed and form feed characters)
res =
is_white (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
is_blank
Experimental
Checks whether input character is a blank character (which includes space and tabs).
res =
is_blank (c)
Elemental function.
c
: shall be an intrinsic character(len=1)
type. It is an intent(in)
argument.
The result is a logical
.
to_lower
Experimental
Converts input character variable to all lowercase.
res =
to_lower (string)
Elemental function.
string
: shall be an intrinsic character type. It is an intent(in)
argument.
The result is an intrinsic character type of the same length as string
.
program example_to_lower
use stdlib_ascii, only: to_lower
implicit none
print'(a)', to_lower("HELLo!") ! returns "hello!"
end program example_to_lower
to_upper
Experimental
Converts input character variable to all uppercase.
res =
to_upper (string)
Elemental function.
string
: shall be an intrinsic character type. It is an intent(in)
argument.
The result is an intrinsic character type of the same length as string
.
program example_to_upper
use stdlib_ascii, only: to_upper
implicit none
print'(a)', to_upper("hello!") ! returns "HELLO!"
end program example_to_upper
to_title
Experimental
Returns the titlecase version of the input character variable.
Title case: First character of every word in the sentence is converted to
uppercase and the rest of the characters are converted to lowercase.
A word is a contiguous sequence of character(s) which consists of alphabetical
character(s) and numeral(s) only and doesn't exclude any alphabetical character
or numeral present next to either of its 2 ends.
res =
to_title (string)
Elemental function.
string
: shall be an intrinsic character type. It is an intent(in)
argument.
The result is an intrinsic character type of the same length as string
.
program example_to_title
use stdlib_ascii, only: to_title
implicit none
print *, to_title("hello there!") ! returns "Hello There!"
print *, to_title("'enquoted'") ! returns "'Enquoted'"
print *, to_title("1st") ! returns "1st"
end program example_to_title
to_sentence
Experimental
Returns the sentencecase version of the input character variable.
The first alphabetical character of the sequence is transformed to uppercase
unless it follows a numeral. The rest of the characters in the sequence are
transformed to lowercase.
res =
to_sentence (string)
Elemental function.
string
: shall be an intrinsic character type. It is an intent(in)
argument.
The result is an intrinsic character type of the same length as string
.
program example_to_sentence
use stdlib_ascii, only: to_sentence
implicit none
print *, to_sentence("hello!") ! returns "Hello!"
print *, to_sentence("'enquoted'") ! returns "'Enquoted'"
print *, to_sentence("1st") ! returns "1st"
end program example_to_sentence
reverse
Experimental
Reverses the order of all characters in the input character type.
res =
reverse (string)
Elemental function.
string
: shall be an intrinsic character type. It is an intent(in)
argument.
The result is an intrinsic character type of the same length as string
.
program example_reverse
use stdlib_ascii, only: reverse
implicit none
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
end program example_reverse