NCEPLIBS-bufr 11.7.1
digit.f
Go to the documentation of this file.
1C> @file
2C> @brief Check whether the characters in a string are all numeric
3
4C> This logical function checks whether the characters in a string
5C> are all numeric.
6C>
7C> @author J. Woollen
8C> @date 1994-01-06
9C>
10C> @param[in] STR -- character*(*): String
11C> @returns digit -- logical: .TRUE. if all characters in STR are
12C> numeric; .FALSE. otherwise
13C>
14C> <b>Program History Log:</b>
15C> | Date | Programmer | Comments |
16C> | -----|------------|----------|
17C> | 1994-01-06 | J. Woollen | Original author |
18C> | 2007-01-19 | J. Ator | Simplified logic |
19C> | 2009-03-23 | J. Ator | Fixed minor bug caused by typo |
20C>
21 LOGICAL FUNCTION digit(STR)
22
23 CHARACTER*(*) str
24 digit = .false.
25 DO i=1,len(str)
26 IF( llt(str(i:i),'0') .OR. lgt(str(i:i),'9') ) GOTO 100
27 ENDDO
28 digit = .true.
29
30C EXIT
31C ----
32
33100 RETURN
34 END
logical function digit(STR)
This logical function checks whether the characters in a string are all numeric.
Definition: digit.f:22