Debian Codegraph @

packages/seacas/libraries/suplib/matstr.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 LOGICAL FUNCTION MATSTR (INSTR, MATCH, NLET)
9 C=======================================================================
10
11 C --*** MATSTR *** (STRLIB) Check if string matches
12 C -- Written by Amy Gilkey - revised 07/01/87
13 C --
14 C --MATSTR true iff the input string is equal to the match string.
15 C --Only NLET letters must be in the input string to match, but if more
16 C --letters are given, they must match the match string exactly.
17 C --
18 C --Parameters:
19 C -- INSTR - IN - the input string
20 C -- MATCH - IN - the match string
21 C -- NLET - IN - number of letters that must match; 0 for exact match
22
23 CHARACTER*(*) INSTR
24 CHARACTER*(*) MATCH
25 INTEGER NLET
26
27 IF (NLET .LE. 0) THEN
28 MATSTR = INSTR .EQ. MATCH
29 ELSE
30 LMATCH = LENSTR (MATCH)
31 LMIN = MIN (LMATCH, NLET)
32 LINSTR = LENSTR (INSTR)
33 IF ((LINSTR .LE. LMATCH) .AND. (LINSTR .GE. LMIN)) THEN
34 IF (LMIN .LT. LINSTR) LMIN = LINSTR
35 MATSTR = INSTR(:LMIN) .EQ. MATCH(:LMIN)
36 ELSE
37 MATSTR = .FALSE.
38 END IF
39 END IF
40
41 RETURN
42 END