stdlib_ascii
模块stdlib_ascii
模块提供了用于处理和操作内建字符变量和常量的过程。
stdlib_ascii
提供的常量注意
常量的规范目前尚不完整。
stdlib_ascii
过程的规范注意
过程的规范目前尚不完整。
to_lower
实验性
将输入字符变量转换为全小写。
res =
to_lower (string)
纯函数。
string
:应为内建字符类型。它是一个intent(in)
参数。
结果是与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
实验性
将输入字符变量转换为全大写。
res =
to_upper (string)
纯函数。
string
:应为内建字符类型。它是一个intent(in)
参数。
结果是与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
实验性
返回输入字符变量的标题大小写版本。
标题大小写:句中每个单词的第一个字符转换为大写,其余字符转换为小写。
单词是由字母字符和数字字符组成的连续字符序列,并且不排除其两端任一侧存在的任何字母字符或数字字符。
res =
to_title (string)
纯函数。
string
:应为内建字符类型。它是一个intent(in)
参数。
结果是与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
实验性
返回输入字符变量的句子大小写版本。
序列的第一个字母字符将转换为大写,除非它紧跟在数字字符之后。序列中的其余字符将转换为小写。
res =
to_sentence (string)
纯函数。
string
:应为内建字符类型。它是一个intent(in)
参数。
结果是与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
实验性
反转输入字符类型中所有字符的顺序。
res =
reverse (string)
纯函数。
string
:应为内建字符类型。它是一个intent(in)
参数。
结果是与string
长度相同的内建字符类型。
program example_reverse
use stdlib_ascii, only: reverse
implicit none
print'(a)', reverse("Hello, World!") ! returns "!dlroW ,olleH"
end program example_reverse