(git:6a2e663)
string_utilities Module Reference

Utilities for string manipulations. More...

Functions/Subroutines

elemental integer function, public typo_match (string, typo_string)
 returns a non-zero positive value if typo_string equals string apart from a few typos. It is case sensitive, apart from typos. More...
 
pure character(len=size(array)) function, public a2s (array)
 Converts a character-array into a string. More...
 
subroutine, public ascii_to_string (nascii, string)
 Convert a sequence of integer numbers (ASCII code) to a string. Blanks are inserted for invalid ASCII code numbers. More...
 
subroutine, public compress (string, full)
 Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated. More...
 
subroutine, public integer_to_string (inumber, string)
 Converts an integer number to a string. The WRITE statement will return an error message, if the number of digits of the integer number is larger the than the length of the supplied string. More...
 
subroutine, public string_to_ascii (string, nascii)
 Convert a string to sequence of integer numbers. More...
 
subroutine, public remove_word (string)
 remove a word from a string (words are separated by white spaces) More...
 
character(len=2 *len(inp_string)) function, public substitute_special_xml_tokens (inp_string)
 Substitutes the five predefined XML entities: &, <, >, ', and ". More...
 
elemental subroutine, public uppercase (string)
 Convert all lower case characters in a string to upper case. More...
 
elemental subroutine, public xstring (string, ia, ib)
 ... More...
 
elemental logical function, public str_comp (str1, str2)
 ... More...
 
elemental logical function, public is_whitespace (testchar)
 returns .true. if the character passed is a whitespace char. More...
 
elemental subroutine, public strip_control_codes (string)
 Strip control codes and extended characters from a string, i.e. replace them with blanks. More...
 
integer function, public strlcpy_c2f (fstring, cstring)
 Copy the content of a \0-terminated C-string to a finite-length Fortran string. More...
 

Variables

character(len=1), parameter, public newline = ACHAR(10)
 

Detailed Description

Utilities for string manipulations.

History
Adapted compress and uppercase for use in CP2K (JGH) string_to_integer and integer_to_string added (06.02.2001, MK) Cleaned (04.01.2004,MK)
Author
MK & JGH

Function/Subroutine Documentation

◆ typo_match()

elemental integer function, public string_utilities::typo_match ( character(len=*), intent(in)  string,
character(len=*), intent(in)  typo_string 
)

returns a non-zero positive value if typo_string equals string apart from a few typos. It is case sensitive, apart from typos.

Parameters
string...
typo_string...
Returns
...
History
02.2006 created [Joost VandeVondele] 09.2020 switch to Levenshtein distance [Ole Schuett]

Definition at line 69 of file string_utilities.F.

Here is the caller graph for this function:

◆ a2s()

pure character(len=size(array)) function, public string_utilities::a2s ( character, dimension(:), intent(in)  array)

Converts a character-array into a string.

Parameters
array...
Returns
...
History
10.2013 created [Ole Schuett]

Definition at line 133 of file string_utilities.F.

Here is the caller graph for this function:

◆ ascii_to_string()

subroutine, public string_utilities::ascii_to_string ( integer, dimension(:), intent(in)  nascii,
character(len=*), intent(out)  string 
)

Convert a sequence of integer numbers (ASCII code) to a string. Blanks are inserted for invalid ASCII code numbers.

Parameters
nascii...
string...
Date
19.10.2000
Author
MK
Version
1.0

Definition at line 3161 of file string_utilities.F.

Here is the caller graph for this function:

◆ compress()

subroutine, public string_utilities::compress ( character(len=*), intent(inout)  string,
logical, intent(in), optional  full 
)

Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.

Parameters
string...
full...
Date
23.06.1998
Author
MK
Version
1.0

Definition at line 3189 of file string_utilities.F.

Here is the caller graph for this function:

◆ integer_to_string()

subroutine, public string_utilities::integer_to_string ( integer, intent(in)  inumber,
character(len=*), intent(out)  string 
)

Converts an integer number to a string. The WRITE statement will return an error message, if the number of digits of the integer number is larger the than the length of the supplied string.

Parameters
inumber...
string...
Date
05.01.2004
Author
MK
Version
1.0

Definition at line 3237 of file string_utilities.F.

Here is the caller graph for this function:

◆ string_to_ascii()

subroutine, public string_utilities::string_to_ascii ( character(len=*), intent(in)  string,
integer, dimension(:), intent(out)  nascii 
)

Convert a string to sequence of integer numbers.

Parameters
string...
nascii...
Date
19.10.2000
Author
MK
Version
1.0

Definition at line 3253 of file string_utilities.F.

Here is the caller graph for this function:

◆ remove_word()

subroutine, public string_utilities::remove_word ( character(len=*), intent(inout)  string)

remove a word from a string (words are separated by white spaces)

Parameters
string...
Version
1.0

Definition at line 3273 of file string_utilities.F.

Here is the caller graph for this function:

◆ substitute_special_xml_tokens()

character(len=2*len(inp_string)) function, public string_utilities::substitute_special_xml_tokens ( character(len=*), intent(in)  inp_string)

Substitutes the five predefined XML entities: &, <, >, ', and ".

Parameters
inp_string...
Returns
... !>
Author
Ole Schuett

Definition at line 3297 of file string_utilities.F.

Here is the caller graph for this function:

◆ uppercase()

elemental subroutine, public string_utilities::uppercase ( character(len=*), intent(inout)  string)

Convert all lower case characters in a string to upper case.

Parameters
string...
Date
22.06.1998
Author
MK
Version
1.0

Definition at line 3360 of file string_utilities.F.

◆ xstring()

elemental subroutine, public string_utilities::xstring ( character(len=*), intent(in)  string,
integer, intent(out)  ia,
integer, intent(out)  ib 
)

...

Parameters
string...
ia...
ib...

Definition at line 3380 of file string_utilities.F.

Here is the caller graph for this function:

◆ str_comp()

elemental logical function, public string_utilities::str_comp ( character(len=*), intent(in)  str1,
character(len=*), intent(in)  str2 
)

...

Parameters
str1...
str2...
Returns
...

Definition at line 3401 of file string_utilities.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_whitespace()

elemental logical function, public string_utilities::is_whitespace ( character(len=1), intent(in)  testchar)

returns .true. if the character passed is a whitespace char.

Parameters
testchar...
Returns
...
History
02.2008 created, AK

Definition at line 3424 of file string_utilities.F.

Here is the caller graph for this function:

◆ strip_control_codes()

elemental subroutine, public string_utilities::strip_control_codes ( character(len=*), intent(inout)  string)

Strip control codes and extended characters from a string, i.e. replace them with blanks.

Parameters
string...
Date
13.12.2019
Author
MK
Version
1.0

Definition at line 3439 of file string_utilities.F.

Here is the caller graph for this function:

◆ strlcpy_c2f()

integer function, public string_utilities::strlcpy_c2f ( character(len=*), intent(out)  fstring,
character(len=1, kind=c_char), dimension(*), intent(in)  cstring 
)

Copy the content of a \0-terminated C-string to a finite-length Fortran string.

The content of the new string may be truncated if the number of characters before the '\0' in the source string exceed the length of the destination string. Based on the strlcpy C function.

Parameters
fstringdestination string
cstringsource string
Returns
the number of characters copied
Author
Tiziano Müller

Definition at line 3462 of file string_utilities.F.

Here is the caller graph for this function:

Variable Documentation

◆ newline

character(len=1), parameter, public string_utilities::newline = ACHAR(10)

Definition at line 29 of file string_utilities.F.