pic_strings Module

This module implements basic string handling routines.


Uses

  • module~~pic_strings~~UsesGraph module~pic_strings pic_strings iso_c_binding iso_c_binding module~pic_strings->iso_c_binding module~pic_ascii pic_ascii module~pic_strings->module~pic_ascii module~pic_optional_value pic_optional_value module~pic_strings->module~pic_optional_value module~pic_string_type pic_string_type module~pic_strings->module~pic_string_type module~pic_types pic_types module~pic_strings->module~pic_types module~pic_ascii->module~pic_types module~pic_optional_value->module~pic_types module~pic_string_type->module~pic_ascii module~pic_string_type->module~pic_optional_value module~pic_string_type->module~pic_types module~pic_types->iso_c_binding iso_fortran_env iso_fortran_env module~pic_types->iso_fortran_env

Used by

  • module~~pic_strings~~UsedByGraph module~pic_strings pic_strings module~pic_string_type_constructor pic_string_type_constructor module~pic_string_type_constructor->module~pic_strings module~pic_strings_to_string pic_strings_to_string module~pic_strings_to_string->module~pic_strings

Interfaces

public interface chomp

Remove trailing characters in set from string. If no character set is provided trailing whitespace is removed.

Version: experimental

  • private pure function chomp_string(string) result(chomped_string)

    Remove trailing characters in set from string. Default character set variant where trailing whitespace is removed.

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string

    Return Value type(string_type)

  • private pure function chomp_char(string) result(chomped_string)

    Remove trailing characters in set from string. Default character set variant where trailing whitespace is removed.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string

    Return Value character(len=:), allocatable

  • private pure function chomp_set_string_char(string, set) result(chomped_string)

    Remove trailing characters in set from string.

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=1), intent(in) :: set(:)

    Return Value type(string_type)

  • private pure function chomp_set_char_char(string, set) result(chomped_string)

    Remove trailing characters in set from string.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=1), intent(in) :: set(:)

    Return Value character(len=:), allocatable

  • private pure function chomp_substring_string_string(string, substring) result(chomped_string)

    Remove trailing substrings from string.

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value type(string_type)

  • private pure function chomp_substring_char_string(string, substring) result(chomped_string)

    Remove trailing substrings from string.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value character(len=:), allocatable

  • private pure function chomp_substring_string_char(string, substring) result(chomped_string)

    Remove trailing substrings from string.

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value type(string_type)

  • private pure function chomp_substring_char_char(string, substring) result(chomped_string)

    Remove trailing substrings from string.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value character(len=:), allocatable

public interface count

Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’

  • private elemental function count_string_string(string, pattern, consider_overlapping) result(res)

    Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: pattern
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function count_string_char(string, pattern, consider_overlapping) result(res)

    Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: pattern
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function count_char_string(string, pattern, consider_overlapping) result(res)

    Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: pattern
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function count_char_char(string, pattern, consider_overlapping) result(res)

    Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: pattern
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

public interface ends_with

Check whether a string ends with substring or not

Version: experimental

  • private elemental function ends_with_string_string(string, substring) result(match)

    Check whether a string ends with substring or not

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value logical

  • private elemental function ends_with_string_char(string, substring) result(match)

    Check whether a string ends with substring or not

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value logical

  • private elemental function ends_with_char_string(string, substring) result(match)

    Check whether a string ends with substring or not

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value logical

  • private pure function ends_with_char_char(string, substring) result(match)

    Check whether a string ends with substring or not

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value logical

public interface find

Finds the starting index of substring ‘pattern’ in the input ‘string’ Specifications

Version: experimental

  • private elemental function find_string_string(string, pattern, occurrence, consider_overlapping) result(res)

    Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: pattern
    integer, intent(in), optional :: occurrence
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function find_string_char(string, pattern, occurrence, consider_overlapping) result(res)

    Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: pattern
    integer, intent(in), optional :: occurrence
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function find_char_string(string, pattern, occurrence, consider_overlapping) result(res)

    Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: pattern
    integer, intent(in), optional :: occurrence
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

  • private elemental function find_char_char(string, pattern, occurrence, consider_overlapping) result(res)

    Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: pattern
    integer, intent(in), optional :: occurrence
    logical, intent(in), optional :: consider_overlapping

    Return Value integer

public interface join

Joins an array of strings into a single string. The chunks are separated with a space, or an optional user-defined separator.

  • private pure function join_string(strings, separator)

    Joins a list of strings with a separator (default: space). Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: strings(:)
    character(len=*), intent(in), optional :: separator

    Return Value type(string_type)

  • private pure function join_char(strings, separator) result(joined)

    Joins a list of strings with a separator (default: space). Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: strings(:)
    character(len=*), intent(in), optional :: separator

    Return Value character(len=:), allocatable

public interface padl

Left pad the input string

  • private pure function padl_string_default(string, output_length) result(res)

    Left pad the input string with ” ” (1 whitespace)

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value type(string_type)

  • private pure function padl_string_pad_with(string, output_length, pad_with) result(res)

    Left pad the input string with the ‘pad_with’ character

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in) :: output_length
    character(len=1), intent(in) :: pad_with

    Return Value type(string_type)

  • private pure function padl_char_default(string, output_length) result(res)

    Left pad the input string with ” ” (1 whitespace)

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value character(kind=output_length), len=max)

  • private pure function padl_char_pad_with(string, output_length, pad_with) result(res)

    Left pad the input string with the ‘pad_with’ character

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in) :: output_length
    character(len=1), intent(in) :: pad_with

    Return Value character(kind=output_length), len=max)

public interface padr

Right pad the input string

  • private pure function padr_string_default(string, output_length) result(res)

    Right pad the input string with ” ” (1 whitespace)

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value type(string_type)

  • private pure function padr_string_pad_with(string, output_length, pad_with) result(res)

    Right pad the input string with the ‘pad_with’ character

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in) :: output_length
    character(len=1), intent(in) :: pad_with

    Return Value type(string_type)

  • private pure function padr_char_default(string, output_length) result(res)

    Right pad the input string with ” ” (1 whitespace)

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value character(kind=output_length), len=max)

  • private pure function padr_char_pad_with(string, output_length, pad_with) result(res)

    Right pad the input string with the ‘pad_with’ character

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in) :: output_length
    character(len=1), intent(in) :: pad_with

    Return Value character(kind=output_length), len=max)

public interface replace_all

Replaces all the occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Version: experimental

  • private pure function replace_all_string_string_string(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: pattern
    type(string_type), intent(in) :: replacement

    Return Value type(string_type)

  • private pure function replace_all_string_string_char(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: pattern
    character(len=*), intent(in) :: replacement

    Return Value type(string_type)

  • private pure function replace_all_string_char_string(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: pattern
    type(string_type), intent(in) :: replacement

    Return Value type(string_type)

  • private pure function replace_all_char_string_string(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: pattern
    type(string_type), intent(in) :: replacement

    Return Value character(len=:), allocatable

  • private pure function replace_all_string_char_char(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: pattern
    character(len=*), intent(in) :: replacement

    Return Value type(string_type)

  • private pure function replace_all_char_string_char(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: pattern
    character(len=*), intent(in) :: replacement

    Return Value character(len=:), allocatable

  • private pure function replace_all_char_char_string(string, pattern, replacement) result(res)

    Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: pattern
    type(string_type), intent(in) :: replacement

    Return Value character(len=:), allocatable

  • private pure function replace_all_char_char_char(string, pattern, replacement) result(res)

    Replaces all the occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: pattern
    character(len=*), intent(in) :: replacement

    Return Value character(len=:), allocatable

public interface slice

Extracts characters from the input string to return a new string

Version: experimental

  • private elemental function slice_string(string, first, last, stride) result(sliced_string)

    Extract the characters from the region between ‘first’ and ‘last’ index (both inclusive) of the input ‘string’ by taking strides of length ‘stride’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in), optional :: first
    integer, intent(in), optional :: last
    integer, intent(in), optional :: stride

    Return Value type(string_type)

  • private pure function slice_char(string, first, last, stride) result(sliced_string)

    Extract the characters from the region between ‘first’ and ‘last’ index (both inclusive) of the input ‘string’ by taking strides of length ‘stride’ Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in), optional :: first
    integer, intent(in), optional :: last
    integer, intent(in), optional :: stride

    Return Value character(len=:), allocatable

public interface starts_with

Check whether a string starts with substring or not

Version: experimental

  • private elemental function starts_with_string_string(string, substring) result(match)

    Check whether a string starts with substring or not

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value logical

  • private elemental function starts_with_string_char(string, substring) result(match)

    Check whether a string starts with substring or not

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value logical

  • private elemental function starts_with_char_string(string, substring) result(match)

    Check whether a string starts with substring or not

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    type(string_type), intent(in) :: substring

    Return Value logical

  • private pure function starts_with_char_char(string, substring) result(match)

    Check whether a string starts with substring or not

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    character(len=*), intent(in) :: substring

    Return Value logical

public interface strip

Remove leading and trailing whitespace characters.

Version: experimental

  • private pure function strip_string(string) result(stripped_string)

    Remove leading and trailing whitespace characters.

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string

    Return Value type(string_type)

  • private pure function strip_char(string) result(stripped_string)

    Remove leading and trailing whitespace characters.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string

    Return Value character(len=:), allocatable

public interface to_c_char

Format or transfer other types as a string.

  • private pure function to_c_char_from_char(value) result(cstr)

    Convert a Fortran character string to a C character array

    Version: experimental

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: value

    Return Value character(kind=c_char, len=1), (len(value)+1)

  • private pure function to_c_char_from_string(value) result(cstr)

    Convert a Fortran string type to a C character array

    Version: experimental

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: value

    Return Value character(kind=c_char, len=1), (slen(value)+1)

public interface to_string

Format or transfer other types as a string.

  • private pure module function to_string_1_i_int32(value) result(string)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: value

    Return Value character(len=:), allocatable

  • private pure module function to_string_1_i_int64(value) result(string)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: value

    Return Value character(len=:), allocatable

  • private pure module function to_string_1_l_fbool(value) result(string)

    Arguments

    Type IntentOptional Attributes Name
    logical(kind=fbool), intent(in) :: value

    Return Value character(len=1)

  • private pure module function to_string_2_i_int32(value, format) result(string)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: value
    character(len=*), intent(in) :: format

    Return Value character(len=:), allocatable

  • private pure module function to_string_2_i_int64(value, format) result(string)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: value
    character(len=*), intent(in) :: format

    Return Value character(len=:), allocatable

  • private pure module function to_string_2_l_fbool(value, format) result(string)

    Arguments

    Type IntentOptional Attributes Name
    logical(kind=fbool), intent(in) :: value
    character(len=*), intent(in) :: format

    Return Value character(len=:), allocatable

  • private pure module function to_string_r_dp(value, format) result(string)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: value
    character(len=*), intent(in), optional :: format

    Return Value character(len=:), allocatable

  • private pure module function to_string_r_sp(value, format) result(string)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: value
    character(len=*), intent(in), optional :: format

    Return Value character(len=:), allocatable

public interface zfill

Left pad the input string with zeros.

  • private pure function zfill_string(string, output_length) result(res)

    Left pad the input string with zeros

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    type(string_type), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value type(string_type)

  • private pure function zfill_char(string, output_length) result(res)

    Left pad the input string with zeros

    Returns a new string

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: string
    integer, intent(in) :: output_length

    Return Value character(kind=output_length), len=max)


Functions

private pure function chomp_char(string) result(chomped_string)

Remove trailing characters in set from string. Default character set variant where trailing whitespace is removed.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Return Value character(len=:), allocatable

private pure function chomp_set_char_char(string, set) result(chomped_string)

Remove trailing characters in set from string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=1), intent(in) :: set(:)

Return Value character(len=:), allocatable

private pure function chomp_set_string_char(string, set) result(chomped_string)

Remove trailing characters in set from string.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=1), intent(in) :: set(:)

Return Value type(string_type)

private pure function chomp_string(string) result(chomped_string)

Remove trailing characters in set from string. Default character set variant where trailing whitespace is removed.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string

Return Value type(string_type)

private pure function chomp_substring_char_char(string, substring) result(chomped_string)

Remove trailing substrings from string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value character(len=:), allocatable

private pure function chomp_substring_char_string(string, substring) result(chomped_string)

Remove trailing substrings from string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value character(len=:), allocatable

private pure function chomp_substring_string_char(string, substring) result(chomped_string)

Remove trailing substrings from string.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value type(string_type)

private pure function chomp_substring_string_string(string, substring) result(chomped_string)

Remove trailing substrings from string.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value type(string_type)

private pure function compute_lps(string) result(lps_array)

Computes longest prefix suffix for each index of the input ‘string’

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Return Value integer, (len(string))

private elemental function count_char_char(string, pattern, consider_overlapping) result(res)

Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: pattern
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function count_char_string(string, pattern, consider_overlapping) result(res)

Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: pattern
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function count_string_char(string, pattern, consider_overlapping) result(res)

Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: pattern
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function count_string_string(string, pattern, consider_overlapping) result(res)

Returns the number of times substring ‘pattern’ has appeared in the input string ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: pattern
logical, intent(in), optional :: consider_overlapping

Return Value integer

private pure function ends_with_char_char(string, substring) result(match)

Check whether a string ends with substring or not

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value logical

private elemental function ends_with_char_string(string, substring) result(match)

Check whether a string ends with substring or not

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value logical

private elemental function ends_with_string_char(string, substring) result(match)

Check whether a string ends with substring or not

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value logical

private elemental function ends_with_string_string(string, substring) result(match)

Check whether a string ends with substring or not

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value logical

private elemental function find_char_char(string, pattern, occurrence, consider_overlapping) result(res)

Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: pattern
integer, intent(in), optional :: occurrence
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function find_char_string(string, pattern, occurrence, consider_overlapping) result(res)

Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: pattern
integer, intent(in), optional :: occurrence
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function find_string_char(string, pattern, occurrence, consider_overlapping) result(res)

Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: pattern
integer, intent(in), optional :: occurrence
logical, intent(in), optional :: consider_overlapping

Return Value integer

private elemental function find_string_string(string, pattern, occurrence, consider_overlapping) result(res)

Returns the starting index of the ‘occurrence’th occurrence of substring ‘pattern’ in input ‘string’ Returns an integer

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: pattern
integer, intent(in), optional :: occurrence
logical, intent(in), optional :: consider_overlapping

Return Value integer

private pure function join_char(strings, separator) result(joined)

Joins a list of strings with a separator (default: space). Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: strings(:)
character(len=*), intent(in), optional :: separator

Return Value character(len=:), allocatable

private pure function join_string(strings, separator)

Joins a list of strings with a separator (default: space). Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: strings(:)
character(len=*), intent(in), optional :: separator

Return Value type(string_type)

private pure function padl_char_default(string, output_length) result(res)

Left pad the input string with ” ” (1 whitespace)

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in) :: output_length

Return Value character(kind=output_length), len=max)

private pure function padl_char_pad_with(string, output_length, pad_with) result(res)

Left pad the input string with the ‘pad_with’ character

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in) :: output_length
character(len=1), intent(in) :: pad_with

Return Value character(kind=output_length), len=max)

private pure function padl_string_default(string, output_length) result(res)

Left pad the input string with ” ” (1 whitespace)

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: output_length

Return Value type(string_type)

private pure function padl_string_pad_with(string, output_length, pad_with) result(res)

Left pad the input string with the ‘pad_with’ character

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: output_length
character(len=1), intent(in) :: pad_with

Return Value type(string_type)

private pure function padr_char_default(string, output_length) result(res)

Right pad the input string with ” ” (1 whitespace)

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in) :: output_length

Return Value character(kind=output_length), len=max)

private pure function padr_char_pad_with(string, output_length, pad_with) result(res)

Right pad the input string with the ‘pad_with’ character

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in) :: output_length
character(len=1), intent(in) :: pad_with

Return Value character(kind=output_length), len=max)

private pure function padr_string_default(string, output_length) result(res)

Right pad the input string with ” ” (1 whitespace)

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: output_length

Return Value type(string_type)

private pure function padr_string_pad_with(string, output_length, pad_with) result(res)

Right pad the input string with the ‘pad_with’ character

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: output_length
character(len=1), intent(in) :: pad_with

Return Value type(string_type)

private pure function replace_all_char_char_char(string, pattern, replacement) result(res)

Replaces all the occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: replacement

Return Value character(len=:), allocatable

private pure function replace_all_char_char_string(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: pattern
type(string_type), intent(in) :: replacement

Return Value character(len=:), allocatable

private pure function replace_all_char_string_char(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: pattern
character(len=*), intent(in) :: replacement

Return Value character(len=:), allocatable

private pure function replace_all_char_string_string(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: pattern
type(string_type), intent(in) :: replacement

Return Value character(len=:), allocatable

private pure function replace_all_string_char_char(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: pattern
character(len=*), intent(in) :: replacement

Return Value type(string_type)

private pure function replace_all_string_char_string(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: pattern
type(string_type), intent(in) :: replacement

Return Value type(string_type)

private pure function replace_all_string_string_char(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: pattern
character(len=*), intent(in) :: replacement

Return Value type(string_type)

private pure function replace_all_string_string_string(string, pattern, replacement) result(res)

Replaces all occurrences of substring ‘pattern’ in the input ‘string’ with the replacement ‘replacement’ Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: pattern
type(string_type), intent(in) :: replacement

Return Value type(string_type)

private pure function set_to_string(set) result(string)

Implementation to transfer a set of characters to a string representing the set.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: set(:)

Return Value character(len=size)

private pure function slice_char(string, first, last, stride) result(sliced_string)

Extract the characters from the region between ‘first’ and ‘last’ index (both inclusive) of the input ‘string’ by taking strides of length ‘stride’ Returns a new string

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in), optional :: first
integer, intent(in), optional :: last
integer, intent(in), optional :: stride

Return Value character(len=:), allocatable

private elemental function slice_string(string, first, last, stride) result(sliced_string)

Extract the characters from the region between ‘first’ and ‘last’ index (both inclusive) of the input ‘string’ by taking strides of length ‘stride’ Returns a new string

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in), optional :: first
integer, intent(in), optional :: last
integer, intent(in), optional :: stride

Return Value type(string_type)

private pure function starts_with_char_char(string, substring) result(match)

Check whether a string starts with substring or not

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value logical

private elemental function starts_with_char_string(string, substring) result(match)

Check whether a string starts with substring or not

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value logical

private elemental function starts_with_string_char(string, substring) result(match)

Check whether a string starts with substring or not

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
character(len=*), intent(in) :: substring

Return Value logical

private elemental function starts_with_string_string(string, substring) result(match)

Check whether a string starts with substring or not

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
type(string_type), intent(in) :: substring

Return Value logical

private pure function strip_char(string) result(stripped_string)

Remove leading and trailing whitespace characters.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Return Value character(len=:), allocatable

private pure function strip_string(string) result(stripped_string)

Remove leading and trailing whitespace characters.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string

Return Value type(string_type)

private pure function to_c_char_from_char(value) result(cstr)

Convert a Fortran character string to a C character array

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: value

Return Value character(kind=c_char, len=1), (len(value)+1)

private pure function to_c_char_from_string(value) result(cstr)

Convert a Fortran string type to a C character array

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: value

Return Value character(kind=c_char, len=1), (slen(value)+1)

private pure function zfill_char(string, output_length) result(res)

Left pad the input string with zeros

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
integer, intent(in) :: output_length

Return Value character(kind=output_length), len=max)

private pure function zfill_string(string, output_length) result(res)

Left pad the input string with zeros

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(in) :: string
integer, intent(in) :: output_length

Return Value type(string_type)