index Interface

public interface index

Position of a substring within a string.

Returns the position of the start of the leftmost or rightmost occurrence of string substring in string, counting from one. If substring is not present in string, zero is returned.

This method is elemental and returns a default integer scalar value.


Contents


Module Procedures

private elemental function index_string_string(string, substring, back) result(pos)

Position of a sequence of character within a character sequence. In this version both character sequences are represented by a string.

Arguments

Type IntentOptional AttributesName
type(string_type), intent(in) :: string
type(string_type), intent(in) :: substring
logical, intent(in), optional :: back

Return Value integer

private elemental function index_string_char(string, substring, back) result(pos)

Position of a sequence of character within a character sequence. In this version the main character sequence is represented by a string.

Arguments

Type IntentOptional AttributesName
type(string_type), intent(in) :: string
character(len=*), intent(in) :: substring
logical, intent(in), optional :: back

Return Value integer

private elemental function index_char_string(string, substring, back) result(pos)

Position of a sequence of character within a character sequence. In this version the sub character sequence is represented by a string.

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: string
type(string_type), intent(in) :: substring
logical, intent(in), optional :: back

Return Value integer