index Interface

public interface index

Returns the starting position of a substring within a string.


Contents


Module Procedures

private pure elemental function string_index_string(str, substr, back) result(rst)

Returns the starting position of a substring within a string.

Arguments

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

The string to search.

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

The substring for which to search.

logical, intent(in), optional :: back

occurrence rather than the first; else, if true, the index is the start of the first occurrence of the substring.

Return Value integer(kind=int32)

The starting index of the substring.

private pure elemental function string_index_char(str, substr, back) result(rst)

Returns the starting position of a substring within a string.

Arguments

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

The string to search.

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

The substring for which to search.

logical, intent(in), optional :: back

occurrence rather than the first; else, if true, the index is the start of the first occurrence of the substring.

Return Value integer(kind=int32)

The starting index of the substring.

private pure elemental function char_index_string(str, substr, back) result(rst)

Returns the starting position of a substring within a string.

Arguments

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

The string to search.

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

The substring for which to search.

logical, intent(in), optional :: back

occurrence rather than the first; else, if true, the index is the start of the first occurrence of the substring.

Return Value integer(kind=int32)

The starting index of the substring.