/[lmdze]/trunk/IOIPSL/find_str.f
ViewVC logotype

Contents of /trunk/IOIPSL/find_str.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 254 - (show annotations)
Mon Feb 5 10:39:38 2018 UTC (6 years, 3 months ago) by guez
File size: 1218 byte(s)
Move Sources/* to root directory.
1 module find_str_m
2
3 implicit none
4
5 contains
6
7 !=
8 SUBROUTINE find_str (nb_str,str_tab,str_len_tab,str,pos)
9 !---------------------------------------------------------------------
10 !- This subroutine looks for a string in a table
11 !---------------------------------------------------------------------
12 !- INPUT
13 !- nb_str : length of table
14 !- str_tab : Table of strings
15 !- str_len_tab : Table of string-length
16 !- str : Target we are looking for
17 !- OUTPUT
18 !- pos : -1 if str not found, else value in the table
19 !---------------------------------------------------------------------
20 IMPLICIT NONE
21 !-
22 INTEGER :: nb_str
23 CHARACTER(LEN=*),DIMENSION(nb_str) :: str_tab
24 INTEGER,DIMENSION(nb_str) :: str_len_tab
25 CHARACTER(LEN=*) :: str
26 INTEGER :: pos
27 !-
28 INTEGER :: i,il
29 !---------------------------------------------------------------------
30 pos = -1
31 il = LEN_TRIM(str)
32 IF ( nb_str > 0 ) THEN
33 DO i=1,nb_str
34 IF ( (INDEX(str_tab(i),str(1:il)) > 0) &
35 .AND.(str_len_tab(i) == il) ) THEN
36 pos = i
37 EXIT
38 ENDIF
39 ENDDO
40 ENDIF
41 !-------------------------
42 END SUBROUTINE find_str
43
44 end module find_str_m

  ViewVC Help
Powered by ViewVC 1.1.21