;------------------------------------------------------------------------------ ; NAME: REMOVE ; ; PURPOSE: To remove all characters from the given string as specified by ; the parameter array ; ; CALLING SEQUENCE: Result = REMOVE (text, param) ; ; INPUTS: ; Text: String of characters to be cleaned ; Param: A string array of characters to be removed from text ; OUTPUTS: ; Result: String characters removed of all unwanted characters ; ; OPTIONAL INPUTS: none ; ; EXAMPLE: ; To remove all unwanted characters as defined by param: ; IDL> param = ['"',',',')','('] ; IDL> result = REMOVE ("this, here (contained)",param) ; IDL> print, result ; this here contained ; ; PROCEDURES USED: none ; ; MODIFICATION HISTORY: ; Written by Puneet Khetarpal, January 15, 2003 ; ;------------------------------------------------------------------------------ function REMOVE, text, param length = strlen(text) clength = length - 1 plength = n_elements(param)-1 if length NE 0 then begin btext = byte(text) nbtext = bytarr(length) bparam = byte(param) count = fix(0) for c = 0, clength do begin flag = 1 p = 0 for p = 0, plength do begin if btext[c] EQ bparam[p] then flag = -1 endfor if flag NE -1 then begin nbtext[count] = btext[c] count = count + 1 endif endfor if count NE 0 then text = string(nbtext[0:count-1]) endif return, text end