Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(string), | intent(in) | :: | self | The string. |
||
logical, | intent(in), | optional | :: | allow_spaces | Allow leading-trailing spaces. |
Result of the test.
Return true if the string contains a number (real or integer).
elemental function is_number(self, allow_spaces)
!---------------------------------------------------------------------------------------------------------------------------------
!< Return true if the string contains a number (real or integer).
!---------------------------------------------------------------------------------------------------------------------------------
class(string), intent(in) :: self !< The string.
logical, intent(in), optional :: allow_spaces !< Allow leading-trailing spaces.
logical :: is_number !< Result of the test.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
is_number = (self%is_integer(allow_spaces=allow_spaces).or.self%is_real(allow_spaces=allow_spaces))
return
!---------------------------------------------------------------------------------------------------------------------------------
endfunction is_number