string Derived Type

type, public :: string

OOP designed string class.


Components

Type Visibility Attributes Name Initial
character(kind=CK, len=:), public, allocatable :: raw

Raw data.


Type-Bound Procedures

procedure, public, pass(self) :: adjustl => sadjustl

Adjustl replacement.

  • private elemental function sadjustl(self) result(adjusted)

    Left adjust a string by removing leading spaces.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Adjusted string.

procedure, public, pass(self) :: adjustr => sadjustr

Adjustr replacement.

  • private elemental function sadjustr(self) result(adjusted)

    Right adjust a string by removing leading spaces.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Adjusted string.

procedure, public, pass(self) :: count => scount

Count replacement.

  • private elemental function scount(self, substring, ignore_isolated) result(No)

    Count the number of occurences of a substring into a string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: substring

    Substring.

    logical, intent(in), optional :: ignore_isolated

    Ignore “isolated” occurrences.

    Return Value integer

    Number of occurrences.

generic, public :: index => sindex_string_string, sindex_string_character

Index replacement.

  • private elemental function sindex_string_string(self, substring, back) result(i)

    Return the position of the start of the first occurrence of string substring as a substring in string, counting from one. If substring is not present in string, zero is returned. If the back argument is present and true, the return value is the start of the last occurrence rather than the first.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: substring

    Searched substring.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

  • private elemental function sindex_string_character(self, substring, back) result(i)

    Return the position of the start of the first occurrence of string substring as a substring in string, counting from one. If substring is not present in string, zero is returned. If the back argument is present and true, the return value is the start of the last occurrence rather than the first.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: substring

    Searched substring.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, public, pass(self) :: len => slen

Len replacement.

  • private elemental function slen(self) result(l)

    Return the length of a string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value integer

    String length.

procedure, public, pass(self) :: len_trim => slen_trim

Len_trim replacement.

  • private elemental function slen_trim(self) result(l)

    Return the length of a string, ignoring any trailing blanks.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value integer

    String length.

generic, public :: repeat => srepeat_string_string, srepeat_character_string

Repeat replacement.

  • private elemental function srepeat_string_string(self, ncopies) result(repeated)

    Concatenates several copies of an input string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    String to be repeated.

    integer, intent(in) :: ncopies

    Number of string copies.

    Return Value type(string)

    Repeated string.

  • private elemental function srepeat_character_string(rstring, ncopies) result(repeated)

    Concatenates several copies of an input string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: rstring

    String to be repeated.

    integer, intent(in) :: ncopies

    Number of string copies.

    Return Value type(string)

    Repeated string.

generic, public :: scan => sscan_string_string, sscan_string_character

Scan replacement.

  • private elemental function sscan_string_string(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is in set.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

  • private elemental function sscan_string_character(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is in set.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, public, pass(self) :: trim => strim

Trim replacement.

  • private elemental function strim(self) result(trimmed)

    Remove trailing spaces.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Trimmed string.

generic, public :: verify => sverify_string_string, sverify_string_character

Verify replacement.

  • private elemental function sverify_string_string(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is not in set. If all characters of string are found in set, the result is zero.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

  • private elemental function sverify_string_character(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is not in set. If all characters of string are found in set, the result is zero.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, public, pass(self) :: basedir

Return the base directory name of a string containing a file name.

  • private elemental function basedir(self, sep)

    Return the base directory name of a string containing a file name.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Directory separator.

    Return Value type(string)

    Base directory name.

procedure, public, pass(self) :: basename

Return the base file name of a string containing a file name.

  • private elemental function basename(self, sep, extension, strip_last_extension)

    Return the base file name of a string containing a file name.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Directory separator.

    character(kind=CK, len=*), intent(in), optional :: extension

    File extension.

    logical, intent(in), optional :: strip_last_extension

    Flag to enable the stripping of last extension.

    Return Value type(string)

    Base file name.

procedure, public, pass(self) :: camelcase

Return a string with all words capitalized without spaces.

  • private elemental function camelcase(self, sep)

    Return a string with all words capitalized without spaces.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    Camel case string.

procedure, public, pass(self) :: capitalize

Return a string with its first character capitalized and the rest lowercased.

  • private elemental function capitalize(self) result(capitalized)

    Return a string with its first character capitalized and the rest lowercased.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Upper case string.

procedure, public, pass(self) :: chars

Return the raw characters data.

  • private pure function chars(self) result(raw)

    Return the raw characters data.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value character(kind=CK, len=:), allocatable

    Raw characters data.

generic, public :: colorize => colorize_str

Colorize and stylize strings.

  • private pure function colorize_str(self, color_fg, color_bg, style) result(colorized)

    Colorize and stylize strings, DEFAULT kind.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in), optional :: color_fg

    Foreground color definition.

    character(len=*), intent(in), optional :: color_bg

    Background color definition.

    character(len=*), intent(in), optional :: style

    Style definition.

    Return Value character(len=:), allocatable

    Colorized string.

procedure, public, pass(self) :: decode

Decode string.

  • private elemental function decode(self, codec) result(decoded)

    Return a string decoded accordingly the codec.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: codec

    Encoding codec.

    Return Value type(string)

    Decoded string.

procedure, public, pass(self) :: encode

Encode string.

  • private elemental function encode(self, codec) result(encoded)

    Return a string encoded accordingly the codec.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: codec

    Encoding codec.

    Return Value type(string)

    Encoded string.

procedure, public, pass(self) :: escape

Escape backslashes (or custom escape character).

  • private elemental function escape(self, to_escape, esc) result(escaped)

    Escape backslashes (or custom escape character).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=1), intent(in) :: to_escape

    Character to be escaped.

    character(kind=CK, len=*), intent(in), optional :: esc

    Character used to escape.

    Return Value type(string)

    Escaped string.

procedure, public, pass(self) :: extension

Return the extension of a string containing a file name.

  • private elemental function extension(self)

    Return the extension of a string containing a file name.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Extension file name.

procedure, public, pass(self) :: fill

Pad string on the left (or right) with zeros (or other char) to fill width.

  • private elemental function fill(self, width, right, filling_char) result(filled)

    Pad string on the left (or right) with zeros (or other char) to fill width.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer, intent(in) :: width

    Final width of filled string.

    logical, intent(in), optional :: right

    Fill on the right instead of left.

    character(kind=CK, len=1), intent(in), optional :: filling_char

    Filling character (default “0”).

    Return Value type(string)

    Filled string.

procedure, public, pass(self) :: free

Free dynamic memory.

  • private elemental subroutine free(self)

    Free dynamic memory.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: self

    The string.

generic, public :: glob => glob_character, glob_string

Glob search, finds all the pathnames matching a given pattern.

  • private subroutine glob_character(self, pattern, list)

    Glob search (character output), finds all the pathnames matching a given pattern according to the rules used by the Unix shell.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: pattern

    Given pattern.

    character(len=:), intent(out), allocatable :: list(:)

    List of matching pathnames.

  • private subroutine glob_string(self, pattern, list)

    Glob search (string output), finds all the pathnames matching a given pattern according to the rules used by the Unix shell.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: pattern

    Given pattern.

    type(string), intent(out), allocatable :: list(:)

    List of matching pathnames.

generic, public :: insert => insert_string, insert_character

Insert substring into string at a specified position.

  • private elemental function insert_string(self, substring, pos) result(inserted)

    Insert substring into string at a specified position.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: substring

    Substring.

    integer, intent(in) :: pos

    Position from which insert substring.

    Return Value type(string)

    Inserted string.

  • private elemental function insert_character(self, substring, pos) result(inserted)

    Insert substring into string at a specified position.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: substring

    Substring.

    integer, intent(in) :: pos

    Position from which insert substring.

    Return Value type(string)

    Inserted string.

generic, public :: join => join_strings, join_characters

Return a string that is a join of an array of strings or characters.

  • private pure function join_strings(self, array, sep) result(join)

    Return a string that is a join of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

  • private pure function join_characters(self, array, sep) result(join)

    Return a string that is a join of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

Return a string that is a join of an array of strings or characters; Return join 1D string array of an 2D array of strings or characters in columns or rows.

  • private pure function strjoin_strings(array, sep) result(join)

    Return a string that is a join of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

  • private pure function strjoin_characters(array, sep, is_trim) result(join)

    Return a string that is a join of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_trim

    Flag to setup trim character or not

    Return Value type(string)

    The join of array.

  • private pure function strjoin_strings_array(array, sep, is_col) result(join)

    Return a string that is a join of columns or rows of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: array(1:,1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_col

    Direction: ‘columns’ if .true. or ‘rows’ if .false.

    Return Value type(string), allocatable, (:)

    The join of array.

  • private pure function strjoin_characters_array(array, sep, is_trim, is_col) result(join)

    Return a string that is a join of columns or rows of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: array(1:,1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_trim

    Flag to setup trim character or not

    logical, intent(in), optional :: is_col

    Direction: ‘columns’ if .true. or ‘rows’ if .false.

    Return Value type(string), allocatable, (:)

    The join of array.

procedure, public, pass(self) :: lower

Return a string with all lowercase characters.

  • private elemental function lower(self)

    Return a string with all lowercase characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Upper case string.

procedure, public, pass(self) :: partition

Split string at separator and return the 3 parts (before, the separator and after).

  • private pure function partition(self, sep) result(partitions)

    Split string at separator and return the 3 parts (before, the separator and after).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string), (1:3)

    after the separator.

procedure, public, pass(self) :: read_file

Read a file a single string stream.

  • private subroutine read_file(self, file, is_fast, form, iostat, iomsg)

    Read a file as a single string stream.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: self

    The string.

    character(len=*), intent(in) :: file

    File name.

    logical, intent(in), optional :: is_fast

    Flag to enable (super) fast file reading.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: read_line

Read line (record) from a connected unit.

  • private subroutine read_line(self, unit, form, iostat, iomsg)

    Read line (record) from a connected unit.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: self

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: read_lines

Read (all) lines (records) from a connected unit as a single ascii stream.

  • private subroutine read_lines(self, unit, form, iostat, iomsg)

    Read (all) lines (records) from a connected unit as a single ascii stream.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: self

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: replace

Return a string with all occurrences of substring old replaced by new.

  • private elemental function replace(self, old, new, count) result(replaced)

    Return a string with all occurrences of substring old replaced by new.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: old

    Old substring.

    character(kind=CK, len=*), intent(in) :: new

    New substring.

    integer, intent(in), optional :: count

    Number of old occurences to be replaced.

    Return Value type(string)

    The string with old replaced by new.

procedure, public, pass(self) :: reverse

Return a reversed string.

  • private elemental function reverse(self) result(reversed)

    Return a reversed string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    The reversed string.

procedure, public, pass(self) :: search

Search for tagged record into string.

  • private function search(self, tag_start, tag_end, in_string, in_character, istart, iend) result(tag)

    Search for tagged record into string, return the first record found (if any) matching the tags.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: tag_start

    Start tag.

    character(kind=CK, len=*), intent(in) :: tag_end

    End tag.

    type(string), intent(in), optional :: in_string

    Search into this string.

    character(kind=CK, len=*), intent(in), optional :: in_character

    Search into this character string.

    integer, intent(out), optional :: istart

    Starting index of tag inside the string.

    integer, intent(out), optional :: iend

    Ending index of tag inside the string.

    Return Value type(string)

    First tag found.

procedure, public, pass(self) :: slice

Return the raw characters data sliced.

  • private pure function slice(self, istart, iend) result(raw)

    Return the raw characters data sliced.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer, intent(in) :: istart

    Slice start index.

    integer, intent(in) :: iend

    Slice end index.

    Return Value character(kind=CK, len=:), allocatable

    Raw characters data.

procedure, public, pass(self) :: snakecase

Return a string with all words lowercase separated by “_”.

  • private elemental function snakecase(self, sep)

    Return a string with all words lowercase separated by “_”.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    Snake case string.

procedure, public, pass(self) :: split

Return a list of substring in the string, using sep as the delimiter string.

  • private pure subroutine split(self, tokens, sep, max_tokens)

    Return a list of substring in the string, using sep as the delimiter string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(out), allocatable :: tokens(:)

    Tokens substring.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    integer, intent(in), optional :: max_tokens

    Fix the maximum number of returned tokens.

procedure, public, pass(self) :: split_chunked

Return a list of substring in the string, using sep as the delimiter string.

  • private pure subroutine split_chunked(self, tokens, chunks, sep)

    Return a list of substring in the string, using sep as the delimiter string, chunked (memory-efficient) algorithm.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(out), allocatable :: tokens(:)

    Tokens substring.

    integer, intent(in) :: chunks

    Number of chunks.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

procedure, public, pass(self) :: startcase

Return a string with all words capitalized, e.g. title case.

  • private elemental function startcase(self, sep)

    Return a string with all words capitalized, e.g. title case.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    Start case string.

procedure, public, pass(self) :: strip

Return a string with the leading and trailing characters removed.

  • private elemental function strip(self, remove_nulls)

    Return a copy of the string with the leading and trailing characters removed.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    logical, intent(in), optional :: remove_nulls

    Remove null characters at the end.

    Return Value type(string)

    The stripped string.

procedure, public, pass(self) :: swapcase

Return a string with uppercase chars converted to lowercase and vice versa.

  • private elemental function swapcase(self)

    Return a copy of the string with uppercase characters converted to lowercase and vice versa.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Upper case string.

procedure, public, pass(self) :: tempname

Return a safe temporary name suitable for temporary file or directories.

  • private function tempname(self, is_file, prefix, path)

    Return a safe temporary name suitable for temporary file or directories.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    logical, intent(in), optional :: is_file

    True if tempname should be used for file (the default).

    character(len=*), intent(in), optional :: prefix

    Name prefix, otherwise self is used (if allocated).

    character(len=*), intent(in), optional :: path

    Path where file/directory should be used, default ./.

    Return Value character(len=:), allocatable

    Safe (unique) temporary name.

Cast string to number.

  • private elemental function to_integer_I1P(self, kind) result(to_number)

    Cast string to integer (I1P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I1P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I1P)

    The number into the string.

  • private elemental function to_integer_I2P(self, kind) result(to_number)

    Cast string to integer (I2P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I2P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I2P)

    The number into the string.

  • private elemental function to_integer_I4P(self, kind) result(to_number)

    Cast string to integer (I4P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I4P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I4P)

    The number into the string.

  • private elemental function to_integer_I8P(self, kind) result(to_number)

    Cast string to integer (I8P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I8P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I8P)

    The number into the string.

  • private elemental function to_real_R8P(self, kind) result(to_number)

    Cast string to real (R8P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    real(kind=R8P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value real(kind=R8P)

    The number into the string.

  • private elemental function to_real_R4P(self, kind) result(to_number)

    Cast string to real (R4P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    real(kind=R4P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value real(kind=R4P)

    The number into the string.

procedure, public, pass(self) :: unescape

Unescape double backslashes (or custom escaped character).

  • private elemental function unescape(self, to_unescape, unesc) result(unescaped)

    Unescape double backslashes (or custom escaped character).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=1), intent(in) :: to_unescape

    Character to be unescaped.

    character(kind=CK, len=*), intent(in), optional :: unesc

    Character used to unescape.

    Return Value type(string)

    Escaped string.

procedure, public, pass(self) :: unique

Reduce to one (unique) multiple occurrences of a substring into a string.

  • private elemental function unique(self, substring) result(uniq)

    Reduce to one (unique) multiple (sequential) occurrences of a substring into a string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in), optional :: substring

    Substring which multiple occurences must be reduced to one.

    Return Value type(string)

    String parsed.

procedure, public, pass(self) :: upper

Return a string with all uppercase characters.

  • private elemental function upper(self)

    Return a string with all uppercase characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value type(string)

    Upper case string.

procedure, public, pass(self) :: write_file

Write a single string stream into file.

  • private subroutine write_file(self, file, form, iostat, iomsg)

    Write a single string stream into file.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: file

    File name.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: write_line

Write line (record) to a connected unit.

  • private subroutine write_line(self, unit, form, iostat, iomsg)

    Write line (record) to a connected unit.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: write_lines

Write lines (records) to a connected unit.

  • private subroutine write_lines(self, unit, form, iostat, iomsg)

    Write lines (records) to a connected unit.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in), optional :: form

    Format of unit.

    integer, intent(out), optional :: iostat

    IO status code.

    character(len=*), intent(inout), optional :: iomsg

    IO status message.

procedure, public, pass(self) :: end_with

Return true if a string ends with a specified suffix.

  • private elemental function end_with(self, suffix, start, end, ignore_null_eof)

    Return true if a string ends with a specified suffix.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: suffix

    Searched suffix.

    integer, intent(in), optional :: start

    Start position into the string.

    integer, intent(in), optional :: end

    End position into the string.

    logical, intent(in), optional :: ignore_null_eof

    Ignore null character at the end of file.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_allocated

Return true if the string is allocated.

  • private elemental function is_allocated(self)

    Return true if the string is allocated.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_digit

Return true if all characters in the string are digits.

  • private elemental function is_digit(self)

    Return true if all characters in the string are digits.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_integer

Return true if the string contains an integer.

  • private elemental function is_integer(self, allow_spaces)

    Return true if the string contains an integer.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    logical, intent(in), optional :: allow_spaces

    Allow leading-trailing spaces.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_lower

Return true if all characters in the string are lowercase.

  • private elemental function is_lower(self)

    Return true if all characters in the string are lowercase.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_number

Return true if the string contains a number (real or integer).

  • private elemental function is_number(self, allow_spaces)

    Return true if the string contains a number (real or integer).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    logical, intent(in), optional :: allow_spaces

    Allow leading-trailing spaces.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_real

Return true if the string contains an real.

  • private elemental function is_real(self, allow_spaces)

    Return true if the string contains a real.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    logical, intent(in), optional :: allow_spaces

    Allow leading-trailing spaces.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: is_upper

Return true if all characters in the string are uppercase.

  • private elemental function is_upper(self)

    Return true if all characters in the string are uppercase.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    Return Value logical

    Result of the test.

procedure, public, pass(self) :: start_with

Return true if a string starts with a specified prefix.

  • private elemental function start_with(self, prefix, start, end)

    Return true if a string starts with a specified prefix.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: prefix

    Searched prefix.

    integer, intent(in), optional :: start

    Start position into the string.

    integer, intent(in), optional :: end

    End position into the string.

    Return Value logical

    Result of the test.

Assignment operator overloading.

  • private pure subroutine string_assign_string(lhs, rhs)

    Assignment operator from string input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_character(lhs, rhs)

    Assignment operator from character input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_integer_I1P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I1P), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_integer_I2P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I2P), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_integer_I4P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I4P), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_integer_I8P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I8P), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_real_R8P(lhs, rhs)

    Assignment operator from real input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    real(kind=R8P), intent(in) :: rhs

    Right hand side.

  • private pure subroutine string_assign_real_R4P(lhs, rhs)

    Assignment operator from real input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    real(kind=R4P), intent(in) :: rhs

    Right hand side.

Concatenation operator overloading.

  • private pure function string_concat_string(lhs, rhs) result(concat)

    Concatenation with string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

  • private pure function string_concat_character(lhs, rhs) result(concat)

    Concatenation with character.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

  • private pure function character_concat_string(lhs, rhs) result(concat)

    Concatenation with character (inverted).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

Concatenation operator (string output) overloading.

  • private elemental function string_concat_string_string(lhs, rhs) result(concat)

    Concatenation with string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

  • private elemental function string_concat_character_string(lhs, rhs) result(concat)

    Concatenation with character.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

  • private elemental function character_concat_string_string(lhs, rhs) result(concat)

    Concatenation with character (inverted).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

generic, public :: operator(==) => string_eq_string, string_eq_character, character_eq_string

Equal operator overloading.

  • private elemental function string_eq_string(lhs, rhs) result(is_it)

    Equal to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_eq_character(lhs, rhs) result(is_it)

    Equal to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_eq_string(lhs, rhs) result(is_it)

    Equal to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: operator(/=) => string_ne_string, string_ne_character, character_ne_string

Not equal operator overloading.

  • private elemental function string_ne_string(lhs, rhs) result(is_it)

    Not equal to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_ne_character(lhs, rhs) result(is_it)

    Not equal to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_ne_string(lhs, rhs) result(is_it)

    Not equal to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: operator(<) => string_lt_string, string_lt_character, character_lt_string

Lower than operator overloading.

  • private elemental function string_lt_string(lhs, rhs) result(is_it)

    Lower than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_lt_character(lhs, rhs) result(is_it)

    Lower than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_lt_string(lhs, rhs) result(is_it)

    Lower than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: operator(<=) => string_le_string, string_le_character, character_le_string

Lower equal than operator overloading.

  • private elemental function string_le_string(lhs, rhs) result(is_it)

    Lower equal than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_le_character(lhs, rhs) result(is_it)

    Lower equal than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_le_string(lhs, rhs) result(is_it)

    Lower equal than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: operator(>=) => string_ge_string, string_ge_character, character_ge_string

Greater equal than operator overloading.

  • private elemental function string_ge_string(lhs, rhs) result(is_it)

    Greater equal than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_ge_character(lhs, rhs) result(is_it)

    Greater equal than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_ge_string(lhs, rhs) result(is_it)

    Greater equal than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: operator(>) => string_gt_string, string_gt_character, character_gt_string

Greater than operator overloading.

  • private elemental function string_gt_string(lhs, rhs) result(is_it)

    Greater than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function string_gt_character(lhs, rhs) result(is_it)

    Greater than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

  • private elemental function character_gt_string(lhs, rhs) result(is_it)

    Greater than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

generic, public :: read(formatted) => read_formatted

Formatted input.

  • private subroutine read_formatted(dtv, unit, iotype, v_list, iostat, iomsg)

    Formatted input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in) :: iotype

    Edit descriptor.

    integer, intent(in) :: v_list(:)

    Edit descriptor list.

    integer, intent(out) :: iostat

    IO status code.

    character(len=*), intent(inout) :: iomsg

    IO status message.

generic, public :: write(formatted) => write_formatted

Formatted output.

  • private subroutine write_formatted(dtv, unit, iotype, v_list, iostat, iomsg)

    Formatted output.

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(kind=CK, len=*), intent(in) :: iotype

    Edit descriptor.

    integer, intent(in) :: v_list(:)

    Edit descriptor list.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

generic, public :: read(unformatted) => read_unformatted

Unformatted input.

  • private subroutine read_unformatted(dtv, unit, iostat, iomsg)

    Unformatted input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

generic, public :: write(unformatted) => write_unformatted

Unformatted output.

  • private subroutine write_unformatted(dtv, unit, iostat, iomsg)

    Unformatted output.

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(self) :: sindex_string_string

Index replacement.

  • private elemental function sindex_string_string(self, substring, back) result(i)

    Return the position of the start of the first occurrence of string substring as a substring in string, counting from one. If substring is not present in string, zero is returned. If the back argument is present and true, the return value is the start of the last occurrence rather than the first.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: substring

    Searched substring.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: sindex_string_character

Index replacement.

  • private elemental function sindex_string_character(self, substring, back) result(i)

    Return the position of the start of the first occurrence of string substring as a substring in string, counting from one. If substring is not present in string, zero is returned. If the back argument is present and true, the return value is the start of the last occurrence rather than the first.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: substring

    Searched substring.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: srepeat_string_string

Repeat replacement.

  • private elemental function srepeat_string_string(self, ncopies) result(repeated)

    Concatenates several copies of an input string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    String to be repeated.

    integer, intent(in) :: ncopies

    Number of string copies.

    Return Value type(string)

    Repeated string.

procedure, private, nopass :: srepeat_character_string

Repeat replacement.

  • private elemental function srepeat_character_string(rstring, ncopies) result(repeated)

    Concatenates several copies of an input string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: rstring

    String to be repeated.

    integer, intent(in) :: ncopies

    Number of string copies.

    Return Value type(string)

    Repeated string.

procedure, private, pass(self) :: sscan_string_string

Scan replacement.

  • private elemental function sscan_string_string(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is in set.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: sscan_string_character

Scan replacement.

  • private elemental function sscan_string_character(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is in set.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: sverify_string_string

Verify replacement.

  • private elemental function sverify_string_string(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is not in set. If all characters of string are found in set, the result is zero.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: sverify_string_character

Verify replacement.

  • private elemental function sverify_string_character(self, set, back) result(i)

    Return the leftmost (if back is either absent or equals false, otherwise the rightmost) character of string that is not in set. If all characters of string are found in set, the result is zero.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: set

    Searched set.

    logical, intent(in), optional :: back

    Start of the last occurrence rather than the first.

    Return Value integer

    Result of the search.

procedure, private, pass(self) :: colorize_str

Colorize and stylize strings.

  • private pure function colorize_str(self, color_fg, color_bg, style) result(colorized)

    Colorize and stylize strings, DEFAULT kind.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in), optional :: color_fg

    Foreground color definition.

    character(len=*), intent(in), optional :: color_bg

    Background color definition.

    character(len=*), intent(in), optional :: style

    Style definition.

    Return Value character(len=:), allocatable

    Colorized string.

procedure, private, pass(self) :: glob_character

Glob search (character output).

  • private subroutine glob_character(self, pattern, list)

    Glob search (character output), finds all the pathnames matching a given pattern according to the rules used by the Unix shell.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: pattern

    Given pattern.

    character(len=:), intent(out), allocatable :: list(:)

    List of matching pathnames.

procedure, private, pass(self) :: glob_string

Glob search (string output).

  • private subroutine glob_string(self, pattern, list)

    Glob search (string output), finds all the pathnames matching a given pattern according to the rules used by the Unix shell.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: pattern

    Given pattern.

    type(string), intent(out), allocatable :: list(:)

    List of matching pathnames.

procedure, private, pass(self) :: insert_string

Insert substring into string at a specified position.

  • private elemental function insert_string(self, substring, pos) result(inserted)

    Insert substring into string at a specified position.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: substring

    Substring.

    integer, intent(in) :: pos

    Position from which insert substring.

    Return Value type(string)

    Inserted string.

procedure, private, pass(self) :: insert_character

Insert substring into string at a specified position.

  • private elemental function insert_character(self, substring, pos) result(inserted)

    Insert substring into string at a specified position.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(len=*), intent(in) :: substring

    Substring.

    integer, intent(in) :: pos

    Position from which insert substring.

    Return Value type(string)

    Inserted string.

procedure, private, pass(self) :: join_strings

Return join string of an array of strings.

  • private pure function join_strings(self, array, sep) result(join)

    Return a string that is a join of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    type(string), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

procedure, private, pass(self) :: join_characters

Return join string of an array of characters.

  • private pure function join_characters(self, array, sep) result(join)

    Return a string that is a join of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

procedure, private, nopass :: strjoin_strings

Return join string of an array of strings.

  • private pure function strjoin_strings(array, sep) result(join)

    Return a string that is a join of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    Return Value type(string)

    The join of array.

procedure, private, nopass :: strjoin_characters

Return join string of an array of strings.

  • private pure function strjoin_characters(array, sep, is_trim) result(join)

    Return a string that is a join of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: array(1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_trim

    Flag to setup trim character or not

    Return Value type(string)

    The join of array.

procedure, private, nopass :: strjoin_strings_array

Return join 1D string array of an 2D array of strings in columns or rows.

  • private pure function strjoin_strings_array(array, sep, is_col) result(join)

    Return a string that is a join of columns or rows of an array of strings.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: array(1:,1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_col

    Direction: ‘columns’ if .true. or ‘rows’ if .false.

    Return Value type(string), allocatable, (:)

    The join of array.

procedure, private, nopass :: strjoin_characters_array

Return join 1D string array of an 2D array of characters in columns or rows.

  • private pure function strjoin_characters_array(array, sep, is_trim, is_col) result(join)

    Return a string that is a join of columns or rows of an array of characters.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: array(1:,1:)

    Array to be joined.

    character(kind=CK, len=*), intent(in), optional :: sep

    Separator.

    logical, intent(in), optional :: is_trim

    Flag to setup trim character or not

    logical, intent(in), optional :: is_col

    Direction: ‘columns’ if .true. or ‘rows’ if .false.

    Return Value type(string), allocatable, (:)

    The join of array.

procedure, private, pass(self) :: to_integer_I1P

Cast string to integer.

  • private elemental function to_integer_I1P(self, kind) result(to_number)

    Cast string to integer (I1P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I1P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I1P)

    The number into the string.

procedure, private, pass(self) :: to_integer_I2P

Cast string to integer.

  • private elemental function to_integer_I2P(self, kind) result(to_number)

    Cast string to integer (I2P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I2P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I2P)

    The number into the string.

procedure, private, pass(self) :: to_integer_I4P

Cast string to integer.

  • private elemental function to_integer_I4P(self, kind) result(to_number)

    Cast string to integer (I4P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I4P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I4P)

    The number into the string.

procedure, private, pass(self) :: to_integer_I8P

Cast string to integer.

  • private elemental function to_integer_I8P(self, kind) result(to_number)

    Cast string to integer (I8P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    integer(kind=I8P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value integer(kind=I8P)

    The number into the string.

procedure, private, pass(self) :: to_real_R4P

Cast string to real.

  • private elemental function to_real_R4P(self, kind) result(to_number)

    Cast string to real (R4P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    real(kind=R4P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value real(kind=R4P)

    The number into the string.

procedure, private, pass(self) :: to_real_R8P

Cast string to real.

  • private elemental function to_real_R8P(self, kind) result(to_number)

    Cast string to real (R8P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    real(kind=R8P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value real(kind=R8P)

    The number into the string.

procedure, private, pass(self) :: to_real_R16P

Cast string to real.

  • private elemental function to_real_R16P(self, kind) result(to_number)

    Cast string to real (R16P).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    real(kind=R16P), intent(in) :: kind

    Mold parameter for kind detection.

    Return Value real(kind=R16P)

    The number into the string.

procedure, private, pass(lhs) :: string_assign_string

Assignment operator from string input.

  • private pure subroutine string_assign_string(lhs, rhs)

    Assignment operator from string input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_character

Assignment operator from character input.

  • private pure subroutine string_assign_character(lhs, rhs)

    Assignment operator from character input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_integer_I1P

Assignment operator from integer input.

  • private pure subroutine string_assign_integer_I1P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I1P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_integer_I2P

Assignment operator from integer input.

  • private pure subroutine string_assign_integer_I2P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I2P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_integer_I4P

Assignment operator from integer input.

  • private pure subroutine string_assign_integer_I4P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I4P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_integer_I8P

Assignment operator from integer input.

  • private pure subroutine string_assign_integer_I8P(lhs, rhs)

    Assignment operator from integer input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    integer(kind=I8P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_real_R4P

Assignment operator from real input.

  • private pure subroutine string_assign_real_R4P(lhs, rhs)

    Assignment operator from real input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    real(kind=R4P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_real_R8P

Assignment operator from real input.

  • private pure subroutine string_assign_real_R8P(lhs, rhs)

    Assignment operator from real input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    real(kind=R8P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_assign_real_R16P

Assignment operator from real input.

  • private pure subroutine string_assign_real_R16P(lhs, rhs)

    Assignment operator from real input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: lhs

    Left hand side.

    real(kind=R16P), intent(in) :: rhs

    Right hand side.

procedure, private, pass(lhs) :: string_concat_string

Concatenation with string.

  • private pure function string_concat_string(lhs, rhs) result(concat)

    Concatenation with string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

procedure, private, pass(lhs) :: string_concat_character

Concatenation with character.

  • private pure function string_concat_character(lhs, rhs) result(concat)

    Concatenation with character.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

procedure, private, pass(rhs) :: character_concat_string

Concatenation with character (inverted).

  • private pure function character_concat_string(lhs, rhs) result(concat)

    Concatenation with character (inverted).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value character(kind=CK, len=:), allocatable

    Concatenated string.

procedure, private, pass(lhs) :: string_concat_string_string

Concatenation with string (string output).

  • private elemental function string_concat_string_string(lhs, rhs) result(concat)

    Concatenation with string.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

procedure, private, pass(lhs) :: string_concat_character_string

Concatenation with character (string output).

  • private elemental function string_concat_character_string(lhs, rhs) result(concat)

    Concatenation with character.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

procedure, private, pass(rhs) :: character_concat_string_string

Concatenation with character (inverted, string output).

  • private elemental function character_concat_string_string(lhs, rhs) result(concat)

    Concatenation with character (inverted).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value type(string)

    Concatenated string.

procedure, private, pass(lhs) :: string_eq_string

Equal to string logical operator.

  • private elemental function string_eq_string(lhs, rhs) result(is_it)

    Equal to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_eq_character

Equal to character logical operator.

  • private elemental function string_eq_character(lhs, rhs) result(is_it)

    Equal to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_eq_string

Equal to character (inverted) logical operator.

  • private elemental function character_eq_string(lhs, rhs) result(is_it)

    Equal to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_ne_string

Not equal to string logical operator.

  • private elemental function string_ne_string(lhs, rhs) result(is_it)

    Not equal to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_ne_character

Not equal to character logical operator.

  • private elemental function string_ne_character(lhs, rhs) result(is_it)

    Not equal to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_ne_string

Not equal to character (inverted) logical operator.

  • private elemental function character_ne_string(lhs, rhs) result(is_it)

    Not equal to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_lt_string

Lower than to string logical operator.

  • private elemental function string_lt_string(lhs, rhs) result(is_it)

    Lower than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_lt_character

Lower than to character logical operator.

  • private elemental function string_lt_character(lhs, rhs) result(is_it)

    Lower than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_lt_string

Lower than to character (inverted) logical operator.

  • private elemental function character_lt_string(lhs, rhs) result(is_it)

    Lower than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_le_string

Lower equal than to string logical operator.

  • private elemental function string_le_string(lhs, rhs) result(is_it)

    Lower equal than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_le_character

Lower equal than to character logical operator.

  • private elemental function string_le_character(lhs, rhs) result(is_it)

    Lower equal than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_le_string

Lower equal than to character (inverted) logical operator.

  • private elemental function character_le_string(lhs, rhs) result(is_it)

    Lower equal than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_ge_string

Greater equal than to string logical operator.

  • private elemental function string_ge_string(lhs, rhs) result(is_it)

    Greater equal than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_ge_character

Greater equal than to character logical operator.

  • private elemental function string_ge_character(lhs, rhs) result(is_it)

    Greater equal than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_ge_string

Greater equal than to character (inverted) logical operator.

  • private elemental function character_ge_string(lhs, rhs) result(is_it)

    Greater equal than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_gt_string

Greater than to string logical operator.

  • private elemental function string_gt_string(lhs, rhs) result(is_it)

    Greater than to string logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    type(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(lhs) :: string_gt_character

Greater than to character logical operator.

  • private elemental function string_gt_character(lhs, rhs) result(is_it)

    Greater than to character logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: lhs

    Left hand side.

    character(kind=CK, len=*), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(rhs) :: character_gt_string

Greater than to character (inverted) logical operator.

  • private elemental function character_gt_string(lhs, rhs) result(is_it)

    Greater than to character (inverted) logical operator.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    character(kind=CK, len=*), intent(in) :: lhs

    Left hand side.

    class(string), intent(in) :: rhs

    Right hand side.

    Return Value logical

    Opreator test result.

procedure, private, pass(dtv) :: read_formatted

Formatted input.

  • private subroutine read_formatted(dtv, unit, iotype, v_list, iostat, iomsg)

    Formatted input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(len=*), intent(in) :: iotype

    Edit descriptor.

    integer, intent(in) :: v_list(:)

    Edit descriptor list.

    integer, intent(out) :: iostat

    IO status code.

    character(len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: read_delimited

Read a delimited input.

  • private subroutine read_delimited(dtv, unit, delim, iostat, iomsg)

    Read a delimited string from a unit connected for formatted input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(out) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(kind=CK, len=1), intent(in) :: delim

    String delimiter.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: read_undelimited

Read an undelimited input.

  • private subroutine read_undelimited(dtv, unit, terminators, iostat, iomsg)

    Read an undelimited string up until end of record or a character from a set of terminators is encountered.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(kind=CK, len=*), intent(in) :: terminators

    Characters that are considered to terminate the string. Blanks in this string are meaningful.

    integer, intent(out) :: iostat

    IO status code.

    character(len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: read_undelimited_listdirected

Read an undelimited list directed input.

  • private subroutine read_undelimited_listdirected(dtv, unit, iostat, iomsg)

    Read an undelimited (no leading apostrophe or double quote) character value according to the rules for list directed input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    integer, intent(out) :: iostat

    IO status code.

    character(len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: write_formatted

Formatted output.

  • private subroutine write_formatted(dtv, unit, iotype, v_list, iostat, iomsg)

    Formatted output.

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    character(kind=CK, len=*), intent(in) :: iotype

    Edit descriptor.

    integer, intent(in) :: v_list(:)

    Edit descriptor list.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: read_unformatted

Unformatted input.

  • private subroutine read_unformatted(dtv, unit, iostat, iomsg)

    Unformatted input.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(inout) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(dtv) :: write_unformatted

Unformatted output.

  • private subroutine write_unformatted(dtv, unit, iostat, iomsg)

    Unformatted output.

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: dtv

    The string.

    integer, intent(in) :: unit

    Logical unit.

    integer, intent(out) :: iostat

    IO status code.

    character(kind=CK, len=*), intent(inout) :: iomsg

    IO status message.

procedure, private, pass(self) :: replace_one_occurrence

Replace the first occurrence of substring old by new.

  • private elemental function replace_one_occurrence(self, old, new) result(replaced)

    Return a string with the first occurrence of substring old replaced by new.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(string), intent(in) :: self

    The string.

    character(kind=CK, len=*), intent(in) :: old

    Old substring.

    character(kind=CK, len=*), intent(in) :: new

    New substring.

    Return Value type(string)

    The string with old replaced by new.

Source Code

type :: string
  !< OOP designed string class.
  character(kind=CK, len=:), allocatable :: raw !< Raw data.
  contains
    ! public methods
    ! builtins replacements
    procedure, pass(self) :: adjustl  => sadjustl                 !< Adjustl replacement.
    procedure, pass(self) :: adjustr  => sadjustr                 !< Adjustr replacement.
    procedure, pass(self) :: count    => scount                   !< Count replacement.
    generic               :: index    => sindex_string_string, &
                                         sindex_string_character  !< Index replacement.
    procedure, pass(self) :: len      => slen                     !< Len replacement.
    procedure, pass(self) :: len_trim => slen_trim                !< Len_trim replacement.
    generic               :: repeat   => srepeat_string_string, &
                                         srepeat_character_string !< Repeat replacement.
    generic               :: scan     => sscan_string_string,    &
                                         sscan_string_character   !< Scan replacement.
    procedure, pass(self) :: trim     => strim                    !< Trim replacement.
    generic               :: verify   => sverify_string_string, &
                                         sverify_string_character !< Verify replacement.
    ! auxiliary methods
    procedure, pass(self) :: basedir          !< Return the base directory name of a string containing a file name.
    procedure, pass(self) :: basename         !< Return the base file name of a string containing a file name.
    procedure, pass(self) :: camelcase        !< Return a string with all words capitalized without spaces.
    procedure, pass(self) :: capitalize       !< Return a string with its first character capitalized and the rest lowercased.
    procedure, pass(self) :: chars            !< Return the raw characters data.
    generic               :: colorize => &
                             colorize_str     !< Colorize and stylize strings.
    procedure, pass(self) :: decode           !< Decode string.
    procedure, pass(self) :: encode           !< Encode string.
    procedure, pass(self) :: escape           !< Escape backslashes (or custom escape character).
    procedure, pass(self) :: extension        !< Return the extension of a string containing a file name.
    procedure, pass(self) :: fill             !< Pad string on the left (or right) with zeros (or other char) to fill width.
    procedure, pass(self) :: free             !< Free dynamic memory.
    generic               :: glob =>         &
                             glob_character, &
                             glob_string      !< Glob search, finds all the pathnames matching a given pattern.
    generic               :: insert =>      &
                             insert_string, &
                             insert_character !< Insert substring into string at a specified position.
    generic               :: join =>       &
                             join_strings, &
                             join_characters  !< Return a string that is a join of an array of strings or characters.
    generic               :: strjoin =>   &
                             strjoin_strings, &
                             strjoin_characters, &
                             strjoin_strings_array, &
                             strjoin_characters_array  !< Return a string that is a join of an array of strings or characters;
                                                       !< Return join 1D string array of an 2D array of strings or characters in columns or rows.
    procedure, pass(self) :: lower            !< Return a string with all lowercase characters.
    procedure, pass(self) :: partition        !< Split string at separator and return the 3 parts (before, the separator and after).
    procedure, pass(self) :: read_file        !< Read a file a single string stream.
    procedure, pass(self) :: read_line        !< Read line (record) from a connected unit.
    procedure, pass(self) :: read_lines       !< Read (all) lines (records) from a connected unit as a single ascii stream.
    procedure, pass(self) :: replace          !< Return a string with all occurrences of substring old replaced by new.
    procedure, pass(self) :: reverse          !< Return a reversed string.
    procedure, pass(self) :: search           !< Search for *tagged* record into string.
    procedure, pass(self) :: slice            !< Return the raw characters data sliced.
    procedure, pass(self) :: snakecase        !< Return a string with all words lowercase separated by "_".
    procedure, pass(self) :: split            !< Return a list of substring in the string, using sep as the delimiter string.
    procedure, pass(self) :: split_chunked    !< Return a list of substring in the string, using sep as the delimiter string.
    procedure, pass(self) :: startcase        !< Return a string with all words capitalized, e.g. title case.
    procedure, pass(self) :: strip            !< Return a string with the leading and trailing characters removed.
    procedure, pass(self) :: swapcase         !< Return a string with uppercase chars converted to lowercase and vice versa.
    procedure, pass(self) :: tempname         !< Return a safe temporary name suitable for temporary file or directories.
    generic               :: to_number =>   &
                             to_integer_I1P,&
#ifndef _NVF
                             to_integer_I2P,&
#endif
                             to_integer_I4P,&
                             to_integer_I8P,&
#if defined _R16P
                             to_real_R16P,  &
#endif
                             to_real_R8P,   &
                             to_real_R4P      !< Cast string to number.
    procedure, pass(self) :: unescape         !< Unescape double backslashes (or custom escaped character).
    procedure, pass(self) :: unique           !< Reduce to one (unique) multiple occurrences of a substring into a string.
    procedure, pass(self) :: upper            !< Return a string with all uppercase characters.
    procedure, pass(self) :: write_file       !< Write a single string stream into file.
    procedure, pass(self) :: write_line       !< Write line (record) to a connected unit.
    procedure, pass(self) :: write_lines      !< Write lines (records) to a connected unit.
    ! inquire methods
    procedure, pass(self) :: end_with     !< Return true if a string ends with a specified suffix.
    procedure, pass(self) :: is_allocated !< Return true if the string is allocated.
    procedure, pass(self) :: is_digit     !< Return true if all characters in the string are digits.
    procedure, pass(self) :: is_integer   !< Return true if the string contains an integer.
    procedure, pass(self) :: is_lower     !< Return true if all characters in the string are lowercase.
    procedure, pass(self) :: is_number    !< Return true if the string contains a number (real or integer).
    procedure, pass(self) :: is_real      !< Return true if the string contains an real.
    procedure, pass(self) :: is_upper     !< Return true if all characters in the string are uppercase.
    procedure, pass(self) :: start_with   !< Return true if a string starts with a specified prefix.
    ! operators
    generic :: assignment(=) => string_assign_string,      &
                                string_assign_character,   &
                                string_assign_integer_I1P, &
                                string_assign_integer_I2P, &
                                string_assign_integer_I4P, &
                                string_assign_integer_I8P, &
#if defined _R16P
                                string_assign_real_R16P,   &
#endif
                                string_assign_real_R8P,    &
                                string_assign_real_R4P              !< Assignment operator overloading.
    generic :: operator(//) => string_concat_string,    &
                               string_concat_character, &
                               character_concat_string              !< Concatenation operator overloading.
    generic :: operator(.cat.) => string_concat_string_string,    &
                                  string_concat_character_string, &
                                  character_concat_string_string    !< Concatenation operator (string output) overloading.
    generic :: operator(==) => string_eq_string,    &
                               string_eq_character, &
                               character_eq_string                  !< Equal operator overloading.
    generic :: operator(/=) => string_ne_string,    &
                               string_ne_character, &
                               character_ne_string                  !< Not equal operator overloading.
    generic :: operator(<) => string_lt_string,    &
                              string_lt_character, &
                              character_lt_string                   !< Lower than operator overloading.
    generic :: operator(<=) => string_le_string,    &
                               string_le_character, &
                               character_le_string                  !< Lower equal than operator overloading.
    generic :: operator(>=) => string_ge_string,    &
                               string_ge_character, &
                               character_ge_string                  !< Greater equal than operator overloading.
    generic :: operator(>) => string_gt_string,    &
                              string_gt_character, &
                              character_gt_string                   !< Greater than operator overloading.
    ! IO
    generic :: read(formatted) => read_formatted       !< Formatted input.
    generic :: write(formatted) => write_formatted     !< Formatted output.
    generic :: read(unformatted) => read_unformatted   !< Unformatted input.
    generic :: write(unformatted) => write_unformatted !< Unformatted output.
    ! private methods
    ! builtins replacements
    procedure, private, pass(self) :: sindex_string_string     !< Index replacement.
    procedure, private, pass(self) :: sindex_string_character  !< Index replacement.
    procedure, private, pass(self) :: srepeat_string_string    !< Repeat replacement.
    procedure, private, nopass     :: srepeat_character_string !< Repeat replacement.
    procedure, private, pass(self) :: sscan_string_string      !< Scan replacement.
    procedure, private, pass(self) :: sscan_string_character   !< Scan replacement.
    procedure, private, pass(self) :: sverify_string_string    !< Verify replacement.
    procedure, private, pass(self) :: sverify_string_character !< Verify replacement.
    ! auxiliary methods
    procedure, private, pass(self) :: colorize_str     !< Colorize and stylize strings.
    procedure, private, pass(self) :: glob_character   !< Glob search (character output).
    procedure, private, pass(self) :: glob_string      !< Glob search (string output).
    procedure, private, pass(self) :: insert_string    !< Insert substring into string at a specified position.
    procedure, private, pass(self) :: insert_character !< Insert substring into string at a specified position.
    procedure, private, pass(self) :: join_strings     !< Return join string of an array of strings.
    procedure, private, pass(self) :: join_characters  !< Return join string of an array of characters.
    procedure, private, nopass ::     strjoin_strings  !< Return join string of an array of strings.
    procedure, private, nopass ::     strjoin_characters        !< Return join string of an array of strings.
    procedure, private, nopass ::     strjoin_strings_array     !< Return join 1D string array of an 2D array of strings in columns or rows.
    procedure, private, nopass ::     strjoin_characters_array  !< Return join 1D string array of an 2D array of characters in columns or rows.
    procedure, private, pass(self) :: to_integer_I1P   !< Cast string to integer.
#ifndef _NVF
    procedure, private, pass(self) :: to_integer_I2P   !< Cast string to integer.
#endif
    procedure, private, pass(self) :: to_integer_I4P   !< Cast string to integer.
    procedure, private, pass(self) :: to_integer_I8P   !< Cast string to integer.
    procedure, private, pass(self) :: to_real_R4P      !< Cast string to real.
    procedure, private, pass(self) :: to_real_R8P      !< Cast string to real.
    procedure, private, pass(self) :: to_real_R16P     !< Cast string to real.
    ! assignments
    procedure, private, pass(lhs) :: string_assign_string      !< Assignment operator from string input.
    procedure, private, pass(lhs) :: string_assign_character   !< Assignment operator from character input.
    procedure, private, pass(lhs) :: string_assign_integer_I1P !< Assignment operator from integer input.
    procedure, private, pass(lhs) :: string_assign_integer_I2P !< Assignment operator from integer input.
    procedure, private, pass(lhs) :: string_assign_integer_I4P !< Assignment operator from integer input.
    procedure, private, pass(lhs) :: string_assign_integer_I8P !< Assignment operator from integer input.
    procedure, private, pass(lhs) :: string_assign_real_R4P    !< Assignment operator from real input.
    procedure, private, pass(lhs) :: string_assign_real_R8P    !< Assignment operator from real input.
    procedure, private, pass(lhs) :: string_assign_real_R16P   !< Assignment operator from real input.
    ! concatenation operators
    procedure, private, pass(lhs) :: string_concat_string           !< Concatenation with string.
    procedure, private, pass(lhs) :: string_concat_character        !< Concatenation with character.
    procedure, private, pass(rhs) :: character_concat_string        !< Concatenation with character (inverted).
    procedure, private, pass(lhs) :: string_concat_string_string    !< Concatenation with string (string output).
    procedure, private, pass(lhs) :: string_concat_character_string !< Concatenation with character (string output).
    procedure, private, pass(rhs) :: character_concat_string_string !< Concatenation with character (inverted, string output).
    ! logical operators
    procedure, private, pass(lhs) :: string_eq_string    !< Equal to string logical operator.
    procedure, private, pass(lhs) :: string_eq_character !< Equal to character logical operator.
    procedure, private, pass(rhs) :: character_eq_string !< Equal to character (inverted) logical operator.
    procedure, private, pass(lhs) :: string_ne_string    !< Not equal to string logical operator.
    procedure, private, pass(lhs) :: string_ne_character !< Not equal to character logical operator.
    procedure, private, pass(rhs) :: character_ne_string !< Not equal to character (inverted) logical operator.
    procedure, private, pass(lhs) :: string_lt_string    !< Lower than to string logical operator.
    procedure, private, pass(lhs) :: string_lt_character !< Lower than to character logical operator.
    procedure, private, pass(rhs) :: character_lt_string !< Lower than to character (inverted) logical operator.
    procedure, private, pass(lhs) :: string_le_string    !< Lower equal than to string logical operator.
    procedure, private, pass(lhs) :: string_le_character !< Lower equal than to character logical operator.
    procedure, private, pass(rhs) :: character_le_string !< Lower equal than to character (inverted) logical operator.
    procedure, private, pass(lhs) :: string_ge_string    !< Greater equal than to string logical operator.
    procedure, private, pass(lhs) :: string_ge_character !< Greater equal than to character logical operator.
    procedure, private, pass(rhs) :: character_ge_string !< Greater equal than to character (inverted) logical operator.
    procedure, private, pass(lhs) :: string_gt_string    !< Greater than to string logical operator.
    procedure, private, pass(lhs) :: string_gt_character !< Greater than to character logical operator.
    procedure, private, pass(rhs) :: character_gt_string !< Greater than to character (inverted) logical operator.
    ! IO
    procedure, private, pass(dtv) :: read_formatted                !< Formatted input.
    procedure, private, pass(dtv) :: read_delimited                !< Read a delimited input.
    procedure, private, pass(dtv) :: read_undelimited              !< Read an undelimited input.
    procedure, private, pass(dtv) :: read_undelimited_listdirected !< Read an undelimited list directed input.
    procedure, private, pass(dtv) :: write_formatted               !< Formatted output.
    procedure, private, pass(dtv) :: read_unformatted              !< Unformatted input.
    procedure, private, pass(dtv) :: write_unformatted             !< Unformatted output.
    ! miscellanea
    procedure, private, pass(self) :: replace_one_occurrence !< Replace the first occurrence of substring old by new.
endtype string