Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self | The string. |
Result of the test.
Return true if all characters in the string are digits.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | c | Character counter. |
elemental function is_digit(self)
!---------------------------------------------------------------------------------------------------------------------------------
!< Return true if all characters in the string are digits.
!---------------------------------------------------------------------------------------------------------------------------------
class(string), intent(in) :: self !< The string.
logical :: is_digit !< Result of the test.
integer :: c !< Character counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
is_digit = .false.
if (allocated(self%raw)) then
do c=1, len(self%raw)
select case (self%raw(c:c))
case ('0':'9')
is_digit = .true.
case default
is_digit = .false.
exit
end select
enddo
endif
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction is_digit