Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(kind=CK,len=*), | intent(in) | :: | sstring | The string. |
||
type(string), | intent(in) | :: | set | Searched set. |
||
logical, | intent(in), | optional | :: | back | Start of the last occurrence rather than the first. |
Result of the search.
Return the leftmost (if back
is either absent or equals false, otherwise the rightmost) character of string that is in set
.
elemental function sscan_character_string(sstring, 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`.
!---------------------------------------------------------------------------------------------------------------------------------
character(kind=CK, len=*), intent(in) :: sstring !< The string.
type(string), intent(in) :: set !< Searched set.
logical, intent(in), optional :: back !< Start of the last occurrence rather than the first.
integer :: i !< Result of the search.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
if (allocated(set%raw)) then
i = scan(string=sstring, set=set%raw, back=back)
else
i = 0
endif
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction sscan_character_string