This type defines a string class, with its methods.
More...
|
procedure | writef (s, unit, iotype, v_list, iostat, iomsg) |
|
procedure | upper (s) |
| Returns a copy of the string converted to uppercase.
|
|
procedure | lower (s) |
| Returns a copy of the string converted to lowercase.
|
|
procedure | swapcase (s) |
| Return str with case of letters swapped.
|
|
procedure | reverse (s) |
| Reverse a string.
|
|
procedure | endswith (s, suffix) |
| Return True if S starts with the specified prefix, False otherwise.
|
|
procedure | startswith (s, prefix) |
| Return True if S starts with the specified prefix, False otherwise.
|
|
procedure | lstrip (s, chars) |
| This function returns a copy of the string with leading chars removed.
|
|
procedure | rstrip (s, chars) |
| This function returns a copy of the string with trailing chars removed.
|
|
procedure | strip (s, chars) |
| This function returns a copy of the string with leading and trailing chars removed.
|
|
procedure | count (s, sub, start, end) |
| Return the number of occurrences of substring sub in string S[start:end].
|
|
procedure | center (s, width, fillchar) |
| Center a string to a specified width. The default character to fill in the centered string is a blank character.
|
|
procedure | find (s, sub, start, end) |
| Return the lowest index in S where substring sub is found.
|
|
procedure | replace (s, old, new, count) |
| Return a copy with all occurrences of substring old replaced by new.
|
|
generic | operator (s, other) |
| equal: comparison between two strings
|
|
generic | operator (s, other) |
| not_equal: comparison between two strings
|
|
generic | operator (n, s) |
| Multiply by an integer.
|
|
generic | operator (s, n) |
| Multiplication by integer.
|
|
generic | operator (s, value) |
|
generic | operator (value, s) |
|
generic | operator (s, value) |
|
| formatted (s, unit, iotype, v_list, iostat, iomsg) |
|
|
character(len=:), allocatable | val |
| This holds the string of characters.
|
|
This type defines a string class, with its methods.
◆ center()
procedure center |
( |
class(fstr), intent(in) | s, |
|
|
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] | s | Original string |
[in] | width | Total width of centered string |
[in] | fillchar | Padding character (default to space) |
- Returns
- A centered string of length width.
◆ count()
procedure count |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | sub, |
|
|
integer, intent(in), optional | start, |
|
|
integer, intent(in), optional | end ) |
Return the number of occurrences of substring sub in string S[start:end].
- Parameters
-
[in] | s | Original string |
[in] | sub | substring to count |
[in] | start | initial position to consider |
[in] | end | final position to consider |
- Returns
- Number of occurrences of sub in S
◆ endswith()
procedure endswith |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | suffix ) |
Return True if S starts with the specified prefix, False otherwise.
- Note
- that differs from python method in that does not accept a tuple
- Parameters
-
[in] | s | Original string |
[in] | suffix | substring to test |
- Returns
- .True. if
S
ends with sub
.
◆ find()
procedure find |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | sub, |
|
|
integer, intent(in), optional | start, |
|
|
integer, intent(in), optional | end ) |
Return the lowest index in S where substring sub is found.
- Returns
- position where found
- Parameters
-
[in] | s | original string |
[in] | sub | substring to find |
[in] | start | initial position to search |
[in] | end | final position to search |
◆ formatted()
formatted |
( |
class(fstr), intent(in) | s, |
|
|
integer, intent(in) | unit, |
|
|
character(*), intent(in) | iotype, |
|
|
integer, dimension(:), intent(in) | v_list, |
|
|
integer, intent(out) | iostat, |
|
|
character(*), intent(inout) | iomsg ) |
- Parameters
-
[in] | s | Object to write. |
[in] | unit | Internal unit to write to. |
[in] | iotype | LISTDIRECTED or DTxxx |
[in] | v_list | parameters from fmt spec. |
[out] | iostat | non zero on error, etc. |
[in,out] | iomsg | define if iostat non zero. |
◆ lower()
procedure lower |
( |
class(fstr), intent(in) | s | ) |
|
Returns a copy of the string converted to lowercase.
- Parameters
-
- Returns
- String converted to uppercase
◆ lstrip()
procedure lstrip |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in), optional | chars ) |
This function returns a copy of the string with leading chars removed.
If chars is not present all blank: spaces (achar(32)) and tabs (achar(9)) are removed.
- Note
- that when used with no
chars
argument differs from intrinsic trim
in that it will also strip "tab" characters
- Parameters
-
[in] | s | Original string |
[in] | chars | chars to remove from S |
- Returns
- String with chars removed
◆ operator() [1/7]
generic operator |
( |
integer, intent(in) | n, |
|
|
class(fstr), intent(in) | s ) |
Multiply by an integer.
- Parameters
-
[in] | s | Original string |
[in] | n | number of repetitions |
- Returns
- String multiplied n times
◆ operator() [2/7]
generic operator |
( |
class(fstr), intent(in) | s, |
|
|
integer, intent(in) | n ) |
Multiplication by integer.
- Parameters
-
[in] | s | Original string |
[in] | n | number of repetitions |
- Returns
- String multiplied n times
◆ operator() [3/7]
generic operator |
( |
class(fstr), intent(in) | s, |
|
|
class(fstr), intent(in) | other ) |
equal: comparison between two strings
- Returns
- .True. if equal, .False. if not
- Parameters
-
[in] | s | Left-side of comparison |
[in] | other | Right-side of comparison |
◆ operator() [4/7]
generic operator |
( |
class(fstr), intent(in) | s, |
|
|
class(fstr), intent(in) | other ) |
not_equal: comparison between two strings
- Returns
- .False. if equal, .True. if not
- Parameters
-
[in] | s | Left-side of comparison |
[in] | other | Right-side of comparison |
◆ operator() [5/7]
generic operator |
( |
class(fstr), intent(in) | s, |
|
|
class(fstr), intent(in) | value ) |
- Parameters
-
[in] | s | first string |
[in] | value | Second string |
- Returns
- Joined string
◆ operator() [6/7]
generic operator |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | value ) |
- Parameters
-
[in] | s | First string |
[in] | value | Second string |
- Returns
- Joined string
◆ operator() [7/7]
generic operator |
( |
character(len=*), intent(in) | value, |
|
|
class(fstr), intent(in) | s ) |
- Parameters
-
[in] | s | First string |
[in] | value | Second string |
- Returns
- Joined string
◆ replace()
procedure replace |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | old, |
|
|
character(len=*), intent(in) | new, |
|
|
integer, intent(in), optional | count ) |
Return a copy with all occurrences of substring old replaced by new.
- Parameters
-
[in] | s | original string |
[in] | old | substring to replace |
[in] | new | substring to substitute from old |
[in] | count | Maximum number of occurrences to replace |
- Returns
- New string created
◆ reverse()
procedure reverse |
( |
class(fstr), intent(in) | s | ) |
|
Reverse a string.
- Parameters
-
- Returns
- Reversed string
◆ rstrip()
procedure rstrip |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in), optional | chars ) |
This function returns a copy of the string with trailing chars removed.
If chars is not present all blank: spaces (achar(32)) and tabs (achar(9)) are removed.
- Note
- that when used with no
chars
argument differs from intrinsic trim
in that it will also strip "tab" characters
- Parameters
-
[in] | s | Original string |
[in] | chars | chars to remove from S |
- Returns
- String with chars removed
◆ startswith()
procedure startswith |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in) | prefix ) |
Return True if S starts with the specified prefix, False otherwise.
- Note
- that differs from python method in that does not accept a tuple as prefix
- Parameters
-
[in] | s | Original string |
[in] | prefix | substring to test |
- Returns
- True if
S
starts with prefix
◆ strip()
procedure strip |
( |
class(fstr), intent(in) | s, |
|
|
character(len=*), intent(in), optional | chars ) |
This function returns a copy of the string with leading and trailing chars removed.
If chars is not present all blank: spaces (achar(32)) and tabs (achar(9)) are removed.
- Note
- that when used with no
chars
argument differs from intrinsic trim
in that it will also strip "tab" characters
- Parameters
-
[in] | s | Original string |
[in] | chars | chars to remove from S |
- Returns
- String with chars removed
◆ swapcase()
procedure swapcase |
( |
class(fstr), intent(in) | s | ) |
|
Return str with case of letters swapped.
- Parameters
-
- Returns
- String with cases swapped
◆ upper()
procedure upper |
( |
class(fstr), intent(in) | s | ) |
|
Returns a copy of the string converted to uppercase.
- Parameters
-
- Returns
- String converted to uppercase
◆ writef()
procedure writef |
( |
class(fstr), intent(in) | s, |
|
|
integer, intent(in) | unit, |
|
|
character(*), intent(in) | iotype, |
|
|
integer, dimension(:), intent(in) | v_list, |
|
|
integer, intent(out) | iostat, |
|
|
character(*), intent(inout) | iomsg ) |
- Parameters
-
[in] | s | Object to write. |
[in] | unit | Internal unit to write to. |
[in] | iotype | LISTDIRECTED or DTxxx |
[in] | v_list | parameters from fmt spec. |
[out] | iostat | non zero on error, etc. |
[in,out] | iomsg | define if iostat non zero. |
The documentation for this interface was generated from the following file: