NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
digit.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Check whether the characters in a string are all numeric
3 
4 C> This logical function checks whether the characters in a string
5 C> are all numeric.
6 C>
7 C> @author J. Woollen
8 C> @date 1994-01-06
9 C>
10 C> @param[in] STR -- character*(*): String
11 C> @returns digit -- logical: .TRUE. if all characters in STR are
12 C> numeric; .FALSE. otherwise
13 C>
14 C> <b>Program History Log:</b>
15 C> | Date | Programmer | Comments |
16 C> | -----|------------|----------|
17 C> | 1994-01-06 | J. Woollen | Original author |
18 C> | 2007-01-19 | J. Ator | Simplified logic |
19 C> | 2009-03-23 | J. Ator | Fixed minor bug caused by typo |
20 C>
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 
30 C EXIT
31 C ----
32 
33 100 RETURN
34  END
LOGICAL function digit(STR)
This logical function checks whether the characters in a string are all numeric.
Definition: digit.f:21