NCEPLIBS-bufr 11.7.1
igetfxy.f
Go to the documentation of this file.
1C> @file
2C> @author ATOR @date 2007-01-19
3
4C> THIS FUNCTION LOOKS FOR AND RETURNS A VALID FXY NUMBER
5C> FROM WITHIN THE GIVEN INPUT STRING. THE FXY NUMBER MAY BE IN
6C> FORMAT OF EITHER FXXYYY OR F-XX-YYY WITHIN THE INPUT STRING, BUT
7C> IT IS ALWAYS RETURNED IN FORMAT FXXYYY UPON OUTPUT.
8C>
9C> PROGRAM HISTORY LOG:
10C> 2007-01-19 J. ATOR -- ORIGINAL AUTHOR
11C> - 2021-09-30 J. Ator -- Replace jstchr with Fortran intrinsic
12C> adjustl
13C>
14C> USAGE: IGETFXY ( STR, CFXY )
15C> INPUT ARGUMENT LIST:
16C> STR - CHARACTER*(*): INPUT STRING
17C>
18C> OUTPUT ARGUMENT LIST:
19C> CFXY - CHARACTER*6: FXY NUMBER IN FORMAT FXXYYY
20C> IGETFXY - INTEGER: RETURN CODE:
21C> 0 = normal return
22C> -1 = could not find a valid FXY number in STR
23C>
24C> REMARKS:
25C> THIS ROUTINE CALLS: NUMBCK
26C> THIS ROUTINE IS CALLED BY: GETNTBE SNTBDE SNTBFE
27C> Normally not called by any application
28C> programs.
29C>
30 FUNCTION igetfxy ( STR, CFXY )
31
32
33
34 character*(*) str
35 character*6 cfxy
36
37 parameter( lstr2 = 120 )
38 CHARACTER*(LSTR2) str2
39
40C-----------------------------------------------------------------------
41C-----------------------------------------------------------------------
42
43 igetfxy = -1
44
45 lstr = len( str )
46 IF ( lstr .LT. 6 ) RETURN
47
48C Left-justify a copy of the input string.
49
50 IF ( lstr .GT. lstr2 ) THEN
51 str2(1:lstr2) = str(1:lstr2)
52 ELSE
53 str2 = str
54 ENDIF
55 str2 = adjustl( str2 )
56 IF ( str2 .EQ. ' ' ) RETURN
57
58C Look for an FXY number.
59
60 IF ( index( str2, '-' ) .NE. 0 ) THEN
61C Format of field is F-XX-YYY.
62 cfxy(1:1) = str2(1:1)
63 cfxy(2:3) = str2(3:4)
64 cfxy(4:6) = str2(6:8)
65 ELSE
66C Format of field is FXXYYY.
67 cfxy = str2(1:6)
68 ENDIF
69
70C Check that the FXY number is valid.
71
72 IF ( numbck( cfxy ) .EQ. 0 ) igetfxy = 0
73
74 RETURN
75 END
function igetfxy(STR, CFXY)
THIS FUNCTION LOOKS FOR AND RETURNS A VALID FXY NUMBER FROM WITHIN THE GIVEN INPUT STRING.
Definition: igetfxy.f:31
function numbck(NUMB)
THIS FUNCTION CHECKS THE INPUT CHARACTER STRING TO DETERMINE WHETHER IT CONTAINS A VALID FXY (DESCRIP...
Definition: numbck.f:47