stdlib_ascii
moduleThe stdlib_ascii
module provides procedures for handling and manipulating
intrinsic character variables and constants.
stdlib_ascii
Specification of constants is currently incomplete.
stdlib_ascii
proceduresSpecification of procedures is currently incomplete.
to_lower
Experimental
Converts input character variable to all lowercase.
res = to_lower (string)
Pure 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 demo_to_lower
use stdlib_ascii, only : to_lower
implicit none
print'(a)', to_lower("HELLo!") ! returns "hello!"
end program demo_to_lower
to_upper
Experimental
Converts input character variable to all uppercase.
res = to_upper (string)
Pure 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 demo_to_upper
use stdlib_ascii, only : to_upper
implicit none
print'(a)', to_upper("hello!") ! returns "HELLO!"
end program demo_to_upper
to_title
Experimental
Returns a capitalized version of an input character variable. The first alphabetical character is transformed to uppercase unless it follows a numeral. The rest of the character sequence is transformed to lowercase.
res = to_title (string)
Pure 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 demo_to_title
use stdlib_ascii, only : to_title
implicit none
print*, to_title("hello!") ! returns "Hello!"
print*, to_title("'enquoted'") ! returns "'Enquoted'"
print*, to_title("1st") ! returns "1st"
end program demo_to_title
reverse
Experimental
Reverses the order of all characters in the input character type.
res = reverse (string)
Pure 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 demo_reverse
use stdlib_ascii, only : reverse
implicit none
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
end program demo_reverse
to_string
Experimental
Create a character string representing the value of the provided variable.
res = to_string (string)
Pure function.
val
: shall be an intrinsic integer or logical type. It is an intent(in)
argument.
The result is an intrinsic character type.
program demo_string_value
use stdlib_ascii, only : to_string
implicit none
print'(a)', to_string(-3) ! returns "-3"
print'(a)', to_string(.true.) ! returns "T"
print'(a)', to_string(42) ! returns "42"
end program demo_string_value