Changeset 192 for trunk/SRC/Obsolete


Ignore:
Timestamp:
09/22/06 11:37:08 (18 years ago)
Author:
smasson
Message:

several bugfix + new strsed

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Obsolete/strrepl.pro

    r191 r192  
    44; @file_comments  
    55; replace one (or more) character(s)/string(s) in a string 
     6; --- OBSOLETE --- you should better use strsed.pro 
    67; 
    78; @categories 
     
    1011; @param STR {in}{required} 
    1112; the string to be changed 
     13; 
     14; @param ARG2 {in}{required} 
     15; position of the character(s) to be replaced or a string to be changed in STR. 
    1216; 
    1317; @param RCHAR {in}{required} 
     
    6367 
    6468 
    65 function strrepl,str,agument1,rchar 
     69function strrepl,str,arg2,rchar 
    6670; 
    67   compile_opt idl2, strictarrsubs 
     71  compile_opt idl2, strictarrsubs, obsolete 
    6872; 
    6973    
     
    7377   BStr = byte(str) 
    7478   new = byte(rchar) 
    75    if size(agument1, /type) EQ 7 then begin 
    76       old = byte(agument1) 
    77       index = strpos(str, agument1) 
     79   if size(arg2, /type) EQ 7 then begin 
     80      old = byte(arg2) 
     81      index = strpos(str, arg2) 
    7882      pos = index 
    79       while strpos(str, agument1, pos+1) NE -1 do BEGIN 
    80          pos = strpos(str, agument1, pos+1) 
     83      while strpos(str, arg2, pos+1) NE -1 do BEGIN 
     84         pos = strpos(str, arg2, pos+1) 
    8185         index = [index, pos] 
    8286      ENDWHILE 
     
    8488      if (index[0] lt 0 OR index[0] ge n_elements(BStr)) THEN return,Str 
    8589   ENDIF ELSE BEGIN 
    86       index = agument1 
     90      index = arg2 
    8791      if (index[0] lt 0 OR index[0] ge n_elements(BStr)) then return,Str 
    8892      old = BStr[index[0]] 
Note: See TracChangeset for help on using the changeset viewer.