Skip to content

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

NameTypeIntentAttributesDescription
strincharacter(len=*)inString to be tokenized.
delimitercharacter(len=*)inDelimiter of tokens.
tokscharacter(len=len)outallocatableTokens.
Ntinteger(kind=I4P)outoptionalNumber 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

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString.
substringcharacter(len=*)inSubstring.

replace

Replace substring (only first occurrence) into a string.

Attributes: pure

Returns: character(len=:)

fortran
function replace(string, substring, restring) result(newstring)

Arguments

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString to be modified.
substringcharacter(len=*)inSubstring to be replaced.
restringcharacter(len=*)inString 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

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString to be modified.
substringcharacter(len=*)inSubstring to be replaced.
restringcharacter(len=*)inString 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

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString to be parsed.
substringcharacter(len=*)inSubstring 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

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString 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

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString to be modified.

Call graph