sverify_string_character Function

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

Arguments

TypeIntentOptionalAttributesName
class(string), intent(in) :: self
character(kind=CK,len=*), intent(in) :: set
logical, intent(in), optional :: back

Return Value integer


Called by

proc~~sverify_string_character~2~~CalledByGraph proc~sverify_string_character~2 sverify_string_character interface~verify~2 verify interface~verify~2->proc~sverify_string_character~2

Contents


Source Code

   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.
   !<
   !<```fortran
   !< type(string) :: string1
   !< logical      :: test_passed(2)
   !< string1 = 'Hello World Hello!'
   !< test_passed(1) = string1%verify(set='llo')==verify(string='Hello World Hello!', set='llo')
   !< test_passed(2) = string1%verify(set='llo', back=.true.)==verify(string='Hello World Hello!', set='llo', back=.true.)
   !< print '(L1)', all(test_passed)
   !<```
   !=> T <<<
   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.
   integer                                         :: i     !< Result of the search.

   if (allocated(self%raw)) then
     i = verify(string=self%raw, set=set, back=back)
   else
     i = 0
   endif
   endfunction sverify_string_character