Changeset 122 for IOIPSL/trunk/src/stringop.f90
- Timestamp:
- 08/03/07 15:42:20 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
IOIPSL/trunk/src/stringop.f90
r19 r122 76 76 END FUNCTION findpos 77 77 !=== 78 SUBROUTINE find_str ( nb_str,str_tab,str_len_tab,str,pos)78 SUBROUTINE find_str (str_tab,str,pos) 79 79 !--------------------------------------------------------------------- 80 80 !- This subroutine looks for a string in a table 81 81 !--------------------------------------------------------------------- 82 82 !- INPUT 83 !- nb_str : length of table 84 !- str_tab : Table of strings 85 !- str_len_tab : Table of string-length 86 !- str : Target we are looking for 83 !- str_tab : Table of strings 84 !- str : Target we are looking for 87 85 !- OUTPUT 88 !- pos : -1 if str not found, else value in the table 89 !--------------------------------------------------------------------- 90 IMPLICIT NONE 91 !- 92 INTEGER :: nb_str 93 CHARACTER(LEN=*),DIMENSION(nb_str) :: str_tab 94 INTEGER,DIMENSION(nb_str) :: str_len_tab 95 CHARACTER(LEN=*) :: str 96 INTEGER :: pos 97 !- 98 INTEGER :: i,il 86 !- pos : -1 if str not found, else value in the table 87 !--------------------------------------------------------------------- 88 IMPLICIT NONE 89 !- 90 CHARACTER(LEN=*),DIMENSION(:),INTENT(in) :: str_tab 91 CHARACTER(LEN=*),INTENT(in) :: str 92 INTEGER,INTENT(out) :: pos 93 !- 94 INTEGER :: nb_str,i 99 95 !--------------------------------------------------------------------- 100 96 pos = -1 101 il = LEN_TRIM(str)97 nb_str=SIZE(str_tab) 102 98 IF ( nb_str > 0 ) THEN 103 99 DO i=1,nb_str 104 IF ( (INDEX(str_tab(i),str(1:il)) > 0) & 105 .AND.(str_len_tab(i) == il) ) THEN 100 IF ( TRIM(str_tab(i)) == TRIM(str) ) THEN 106 101 pos = i 107 102 EXIT
Note: See TracChangeset
for help on using the changeset viewer.