NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
digit.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS LOGICAL FUNCTION TESTS THE CHARACTERS IN A STRING TO
5 C> DETERMINE IF THEY ARE ALL DIGITS ('0','1','2','3','4','5','6','7',
6 C> '8' OR '9').
7 C>
8 C> PROGRAM HISTORY LOG:
9 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
10 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
11 C> INTERDEPENDENCIES
12 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED
13 C> DOCUMENTATION (INCLUDING HISTORY)
14 C> 2007-01-19 J. ATOR -- SIMPLIFIED LOGIC
15 C> 2009-03-23 J. ATOR -- FIXED MINOR BUG CAUSED BY TYPO
16 C>
17 C> USAGE: DIGIT (STR)
18 C> INPUT ARGUMENT LIST:
19 C> STR - CHARACTER*(*): STRING
20 C>
21 C> OUTPUT ARGUMENT LIST:
22 C> DIGIT - LOGICAL: TRUE IF ALL CHARACTERS IN STR ARE DIGITS
23 C> ('0' - '9'), OTHERWISE FALSE
24 C>
25 C> REMARKS:
26 C> THIS ROUTINE CALLS: None
27 C> THIS ROUTINE IS CALLED BY: CKTABA NUMBCK STNTBIA
28 C> Normally not called by any application
29 C> programs but it could be.
30 C>
31  LOGICAL FUNCTION digit(STR)
32 
33 
34 
35  CHARACTER*(*) str
36  digit = .false.
37  DO i=1,len(str)
38  IF( llt(str(i:i),'0') .OR. lgt(str(i:i),'9') ) goto 100
39  ENDDO
40  digit = .true.
41 
42 C EXIT
43 C ----
44 
45 100 RETURN
46  END
LOGICAL function digit(STR)
THIS LOGICAL FUNCTION TESTS THE CHARACTERS IN A STRING TO DETERMINE IF THEY ARE ALL DIGITS ('0'...
Definition: digit.f:31