source: trunk/procs/extract_str.pro @ 12

Last change on this file since 12 was 2, checked in by post_it, 17 years ago

Initial import from ~/POST_IT/

File size: 423 bytes
Line 
1FUNCTION extract_str, line, char1, char2
2;
3; extract sub-string of line that is between char1 and char2
4;
5   pos_char1 = strpos(line,char1)
6   pos_char2 = strpos(line,char2)
7   lenght_to_extract = pos_char2-pos_char1-1
8   
9   IF lenght_to_extract LE 0 THEN BEGIN
10      print, 'No sub-string in', line, ' between in : ', char1, char2
11      return,  -1
12   ENDIF
13
14   return, STRMID(line, pos_char1+1, lenght_to_extract)
15END
Note: See TracBrowser for help on using the repository browser.