Appearance
flap_utils_m
FLAP utils.
Source: src/lib/flap_utils_m.f90
Dependencies
Contents
Interfaces
count
Overload intrinsic function count for counting substring occurences into strings.
Module procedures: count_substring
Subroutines
tokenize
Tokenize a string in order to parse it.
@note The dummy array containing tokens must allocatable and its character elements must have the same length of the input string. If the length of the delimiter is higher than the input string one then the output tokens array is allocated with only one element set to input string.
Attributes: pure
fortran
subroutine tokenize(strin, delimiter, toks, Nt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
strin | character(len=*) | in | String to be tokenized. | |
delimiter | character(len=*) | in | Delimiter of tokens. | |
toks | character(len=len) | out | allocatable | Tokens. |
Nt | integer(kind=I4P) | out | optional | Number of tokens. |
Call graph
Functions
count_substring
Count the number of occurences of a substring into a string.
Attributes: elemental
Returns: integer(kind=I4P)
fortran
function count_substring(string, substring) result(No)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String. | |
substring | character(len=*) | in | Substring. |
replace
Replace substring (only first occurrence) into a string.
Attributes: pure
Returns: character(len=:)
fortran
function replace(string, substring, restring) result(newstring)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String to be modified. | |
substring | character(len=*) | in | Substring to be replaced. | |
restring | character(len=*) | in | String to be inserted. |
Call graph
replace_all
Replace substring (all occurrences) into a string.
@note Leading and trailing white spaces are stripped out.
Attributes: pure
Returns: character(len=:)
fortran
function replace_all(string, substring, restring) result(newstring)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String to be modified. | |
substring | character(len=*) | in | Substring to be replaced. | |
restring | character(len=*) | in | String to be inserted. |
Call graph
unique
Reduce to one (unique) multiple (sequential) occurrences of a characters substring into a string.
For example the string ' ab-cre-cre-ab' is reduce to 'ab-cre-ab' if the substring is '-cre'. @note Eventual multiple trailing white space are not reduced to one occurrence.
Attributes: elemental
Returns: character(len=len)
fortran
function unique(string, substring) result(uniq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String to be parsed. | |
substring | character(len=*) | in | Substring which multiple occurences must be reduced to one. |
Call graph
upper_case
Convert the lower case characters of a string to upper case one.
Attributes: elemental
Returns: character(len=len)
fortran
function upper_case(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String to be converted. |
Call graph
wstrip
Strip out leading and trailing white spaces from a string.
Attributes: pure
Returns: character(len=:)
fortran
function wstrip(string) result(newstring)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String to be modified. |
Call graph