Abstract base class (ABC) specification of an extendible string type to hold an arbitrary character sequence.
A minimal implementation of the string class has to provide only a setter function in form of an assignment from a fixed length character variable and getter functions for returning the whole string, a character at a certain index and a range of characters within the bounds of the character sequence.
The ABC takes care of providing the implementations for all functionality that is intrinsic to character variables in Fortran, therefore an implementation should reexport all overloaded generic interfaces from the ABC. Any string class implementation will be compatibile with the non-extendible string_type and fixed length and deferred length character variables by those means.
Implementations of the string class that are encouraged to overwrite the type bound procedures providing those functionality in the ABC with optimized algorithms suitable for their respective representation of the character sequence.
The specification of this module is available here.
Left-adjust the character sequence represented by the string. The length of the character sequence remains unchanged.
Left-adjust the character sequence represented by the string. The length of the character sequence remains unchanged.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Right-adjust the character sequence represented by the string. The length of the character sequence remains unchanged.
Right-adjust the character sequence represented by the string. The length of the character sequence remains unchanged.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Return the character sequence represented by the string.
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
integer, | intent(in) | :: | pos |
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
integer, | intent(in) | :: | start | |||
integer, | intent(in) | :: | last |
Code in ASCII collating sequence.
Code in ASCII collating sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Character-to-integer conversion function.
Character-to-integer conversion function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Position of a substring within a string.
Position of a sequence of character within a character sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
character(len=*), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Returns the length of the character sequence represented by the string.
Returns the length of the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Returns the length of the character sequence without trailing spaces represented by the string.
Returns the length of the character sequence without trailing spaces represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Lexically compare the order of two character sequences being greater equal, The left-hand side, the right-hand side or both character sequences can be represented by a string.
Lexically compare two character sequences for being greater or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare the order of two character sequences being greater, The left-hand side, the right-hand side or both character sequences can be represented by a string.
Lexically compare two character sequences for being greater.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare the order of two character sequences being less equal, The left-hand side, the right-hand side or both character sequences can be represented by a string.
Lexically compare two character sequences for being less or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare the order of two character sequences being less, The left-hand side, the right-hand side or both character sequences can be represented by a string.
Lexically compare two character sequences for being less.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
class(string_class), | intent(in) | :: | rhs |
Repeats the character sequence hold by the string by the number of specified copies.
Repeats the character sequence hold by the string by the number of specified copies.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
integer, | intent(in) | :: | ncopies |
Scan a string for the presence of a set of characters. Scans a string for any of the characters in a set of characters.
Scan a character sequence for any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Scan a character sequence for any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Scan a character sequence for any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
character(len=*), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Scan a character sequence for any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Scan a character sequence for any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Returns the character sequence hold by the string without trailing spaces.
Returns the character sequence hold by the string without trailing spaces.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string |
Scan a string for the absence of a set of characters. Verifies that all the characters in string belong to the set of characters in set.
Verify a character sequence for the absence any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Verify a character sequence for the absence any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Verify a character sequence for the absence any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string_class), | intent(in) | :: | string | |||
character(len=*), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Verify a character sequence for the absence any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Verify a character sequence for the absence any of the characters in a set of characters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
class(string_class), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Abstract base class for string objects
procedure(assign_object_char_interface), public :: assign_object_char | |
generic, public :: assignment(=) => assign_object_char | Assign a character sequence to a string object. |
generic, public :: assignment(=) => assign_object_string | Assign a string type to a string object. |
generic, public :: assignment(=) => assign_object_object | Assign a string type to a string object. |
procedure(get_char_interface), public :: get_char | Return the character sequence represented by the string. |
procedure(get_char_pos_interface), public :: get_char_pos | Return the character sequence represented by the string. |
procedure(get_char_range_interface), public :: get_char_range | Return the character sequence represented by the string. |
procedure(get_int_interface), public :: get_len | Returns the length of the character sequence represented by the string. |
procedure(get_int_interface), public :: get_len_trim | Returns the length of the character sequence without trailing spaces represented by the string. |
generic, public :: operator(//) => concat_object_object, concat_object_string, concat_string_object, concat_object_char, concat_char_object | Compare two character sequences for inequality. |
generic, public :: operator(/=) => ne_object_object, ne_object_string, ne_string_object, ne_object_char, ne_char_object | Compare two character sequences for inequality. |
generic, public :: operator(<) => lt_object_object, lt_object_string, lt_string_object, lt_object_char, lt_char_object | Compare two character sequences for being less. |
generic, public :: operator(<=) => le_object_object, le_object_string, le_string_object, le_object_char, le_char_object | Compare two character sequences for being less or equal. |
generic, public :: operator(==) => eq_object_object, eq_object_string, eq_string_object, eq_object_char, eq_char_object | Compare two character sequences for equality. |
generic, public :: operator(>) => gt_object_object, gt_object_string, gt_string_object, gt_object_char, gt_char_object | Compare two character sequences for being greater. |
generic, public :: operator(>=) => ge_object_object, ge_object_string, ge_string_object, ge_object_char, ge_char_object | Compare two character sequences for being greater or equal. |
generic, public :: read(formatted) => read_formatted | Read a character sequence from a connected formatted unit into the string. |
generic, public :: read(unformatted) => read_unformatted | Read a character sequence from a connected unformatted unit into the string. |
generic, public :: write(formatted) => write_formatted | Write the character sequence hold by the string to a connected formatted unit. |
generic, public :: write(unformatted) => write_unformatted | Write the character sequence hold by the string to a connected unformatted unit. |