fortran-strings 1.3.0
Fortran library of functions for common string manipulations
Loading...
Searching...
No Matches
strings Module Reference

Functions/Subroutines

integer function str_count (str, substr, match_case)
 Count the occurrences of a substring in a string.
character(len=:) function, allocatable str_replace (str, old, new)
 Replace a substring with another substring within a parent string.
character(len=:) function, allocatable str_upper (str)
 Convert all letters to uppercase.
character(len=:) function, allocatable str_lower (str)
 Convert all letters to lowercase.
character(len=:) function, allocatable str_split (str, delim, col)
 Split string based on a character delimiter and return string given by the column number.
character(len=:) function, allocatable str_uniq (str, delim)
 Removed duplicative entries from a delimited string.
character(len=:) function, allocatable str_zfill (str, width)
 Pad a string with zeroes ("0") to specified width. If width is <= input string width, then the original string is returned.
character(len=:) function, allocatable str_center (str, width, fillchar)
 Center a string to a specified width. The default character to fill in the centered string is a blank character.
character(len=:) function, allocatable str_reverse (str)
 Reverse a string.
logical function str_test (str, substr, match_case)
 Return .true. if substr is in str, .false. otherwise.
character(len=:) function, allocatable str_swapcase (str)
 Return str with case of letters swapped.

Function/Subroutine Documentation

◆ str_center()

character(len=:) function, allocatable strings::str_center ( character(len=*), intent(in) str,
integer, intent(in) width,
character(len=1), intent(in), optional fillchar )

Center a string to a specified width. The default character to fill in the centered string is a blank character.

Parameters
[in]str- string to work on
[in]width- width of centered string
[in]fillchar- character to fill centered string. [OPTIONAL]
Returns
centered string

◆ str_count()

integer function strings::str_count ( character(len=*), intent(in) str,
character(len=*), intent(in) substr,
logical, intent(in), optional match_case )

Count the occurrences of a substring in a string.

Parameters
[in]str- string to count from
[in]substr- substring to count
[in]match_case- use case sensitivity (.true.) or not (.false. [DEFAULT]) [OPTIONAL]
Returns
count of substr in str

◆ str_lower()

character(len=:) function, allocatable strings::str_lower ( character(len=*), intent(in) str)

Convert all letters to lowercase.

Parameters
[in]str- string to work on
Returns
modified string with all letters converted to lowercase.

◆ str_replace()

character(len=:) function, allocatable strings::str_replace ( character(len=*), intent(in) str,
character(len=*), intent(in) old,
character(len=*), intent(in) new )

Replace a substring with another substring within a parent string.

Parameters
[in]str- string to work on
[in]old- string to replace
[in]new- string to substritute from old.
Returns
modified string where occurrences of old replaces with new

◆ str_reverse()

character(len=:) function, allocatable strings::str_reverse ( character(len=*), intent(in) str)

Reverse a string.

Parameters
[in]str- string to work on
Returns
string reverse of str

◆ str_split()

character(len=:) function, allocatable strings::str_split ( character(len=*), intent(in) str,
character(len=1), intent(in) delim,
integer, intent(in) col )

Split string based on a character delimiter and return string given by the column number.

Parameters
[in]str- string to work on
[in]delim- character delimiter
[in]col- delimited column to return
Returns
string

◆ str_swapcase()

character(len=:) function, allocatable strings::str_swapcase ( character(len=*), intent(in) str)

Return str with case of letters swapped.

Parameters
[in]str- input string

◆ str_test()

logical function strings::str_test ( character(len=*), intent(in) str,
character(len=*), intent(in) substr,
logical, intent(in), optional match_case )

Return .true. if substr is in str, .false. otherwise.

Parameters
[in]str- string to work on
[in]substr- string to search for in str
[in]match_case- use case sensitivity (.true.) or not (.false. [DEFAULT]) [OPTIONAL]
Returns
.true. or .false.

◆ str_uniq()

character(len=:) function, allocatable strings::str_uniq ( character(len=*), intent(in) str,
character(len=1), intent(in) delim )

Removed duplicative entries from a delimited string.

Parameters
[in]str- string to work on
[in]delim- character delimiter
Returns
modified string

◆ str_upper()

character(len=:) function, allocatable strings::str_upper ( character(len=*), intent(in) str)

Convert all letters to uppercase.

Parameters
[in]str- string to work on
Returns
modified string with all letters converted to uppercase.

◆ str_zfill()

character(len=:) function, allocatable strings::str_zfill ( character(len=*), intent(in) str,
integer, intent(in) width )

Pad a string with zeroes ("0") to specified width. If width is <= input string width, then the original string is returned.

Parameters
[in]str- string to work on
[in]width- width of padded string
Returns
modified string