Implementation of a string type to hold an arbitrary sequence of characters.
This module provides string type compatible with all Fortran instrinsic character procedures as well as overloaded operators for working with character variables.
A string type can be easily constructed by creating a new instance from a character variable or literal by invoking its constructor or by assigning it to a string type. Generally, the string type behaves similar to a deferred length character in most regards but adds memory access safety.
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 | ||
---|---|---|---|---|---|---|
type(string_type), | 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 | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Assign a character sequence to a string.
Assign a character sequence to a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(inout) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Return the character sequence represented by the string.
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
integer, | intent(in) | :: | pos |
Return the character sequence represented by the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | 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 | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Character-to-integer conversion function.
Character-to-integer conversion function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Position of a substring within a string.
Position of a sequence of character within a character sequence. In this version both character sequences are represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence. In this version the main character sequence is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
character(len=*), | intent(in) | :: | substring | |||
logical, | intent(in), | optional | :: | back |
Position of a sequence of character within a character sequence. In this version the sub character sequence is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(string_type), | 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 | ||
---|---|---|---|---|---|---|
type(string_type), | 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 | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater or equal In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | 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. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being greater. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | 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. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less or equal In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | 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. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Lexically compare two character sequences for being less. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Moves the allocated character scalar from 'from' to 'to' Specifications
Moves the allocated character scalar from 'from' to 'to' No output
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(inout) | :: | from | |||
type(string_type), | intent(inout) | :: | to |
Moves the allocated character scalar from 'from' to 'to' No output
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(inout) | :: | from | |||
character(len=:), | intent(out), | allocatable | :: | to |
Moves the allocated character scalar from 'from' to 'to' No output
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(inout), | allocatable | :: | from | ||
type(string_type), | intent(out) | :: | to |
Moves the allocated character scalar from 'from' to 'to' No output
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(inout), | allocatable | :: | from | ||
character(len=:), | intent(out), | allocatable | :: | to |
Concatenate two character sequences, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Concatenate two character sequences. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Concatenate two character sequences. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Concatenate two character sequences. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for inequality, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for inequality. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for inequality. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for inequality. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being less, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for being less. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being less. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for being less. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being less than, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for being less or equal. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being less or equal. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for being less or equal In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for equality, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for equality. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for equality. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for equality. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being greater, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for being greater. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being greater. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for being greater. In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being greater than, the left-hand side, the right-hand side or both character sequences can be represented by a string.
Compare two character sequences for being greater or equal. In this version both character sequences are by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Compare two character sequences for being greater or equal. In this version the left-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | lhs | |||
character(len=*), | intent(in) | :: | rhs |
Compare two character sequences for being greater or equal In this version the right-hand side character sequences is by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lhs | |||
type(string_type), | intent(in) | :: | rhs |
Read a character sequence from a connected unformatted unit into the string.
Read a character sequence from a connected formatted unit into the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(inout) | :: | string | |||
integer, | intent(in) | :: | unit | |||
character(len=*), | intent(in) | :: | iotype | |||
integer, | intent(in) | :: | v_list(:) | |||
integer, | intent(out) | :: | iostat | |||
character(len=*), | intent(inout) | :: | iomsg |
Read a character sequence from a connected unformatted unit into the string.
Read a character sequence from a connected unformatted unit into the string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(inout) | :: | string | |||
integer, | intent(in) | :: | unit | |||
integer, | intent(out) | :: | iostat | |||
character(len=*), | intent(inout) | :: | iomsg |
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 | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
integer, | intent(in) | :: | ncopies |
Reverses the character sequence hold by the input string
Reverse the character sequence hold by the input string
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
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. In this version both the character sequence and the character set are represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version the character sequences is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version the set of characters is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Constructor for new string instances
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in), | optional | :: | string |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int16), | intent(in) | :: | val |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int32), | intent(in) | :: | val |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int64), | intent(in) | :: | val |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int8), | intent(in) | :: | val |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical(kind=lk), | intent(in) | :: | val |
Returns the lowercase version of the character sequence hold by the input string
Convert the character sequence hold by the input string to lower case
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Returns the sentencecase version of the character sequence hold by the input string
Convert the character sequence hold by the input string to sentence case
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Returns the titlecase version of the character sequence hold by the input string
Convert the character sequence hold by the input string to title case
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
Returns the uppercase version of the character sequence hold by the input string
Convert the character sequence hold by the input string to upper case
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string |
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 | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version both the character sequence and the character set are represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version the character sequences is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | 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. In this version the set of characters is represented by a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
type(string_type), | intent(in) | :: | set | |||
logical, | intent(in), | optional | :: | back |
Write the character sequence hold by the string to a connected formatted unit.
Write the character sequence hold by the string to a connected formatted unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
integer, | intent(in) | :: | unit | |||
character(len=*), | intent(in) | :: | iotype | |||
integer, | intent(in) | :: | v_list(:) | |||
integer, | intent(out) | :: | iostat | |||
character(len=*), | intent(inout) | :: | iomsg |
Write the character sequence hold by the string to a connected unformatted unit.
Write the character sequence hold by the string to a connected unformatted unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(string_type), | intent(in) | :: | string | |||
integer, | intent(in) | :: | unit | |||
integer, | intent(out) | :: | iostat | |||
character(len=*), | intent(inout) | :: | iomsg |
String type holding an arbitrary sequence of characters.
Constructor for new string instances
private elemental,module function new_string(string) | |
private elemental,module function new_string_from_integer_int16(val) | |
private elemental,module function new_string_from_integer_int32(val) | |
private elemental,module function new_string_from_integer_int64(val) | |
private elemental,module function new_string_from_integer_int8(val) | |
private elemental,module function new_string_from_logical_lk(val) |