/usr/share/gnudatalanguage/astrolib/remchar.pro is in gdl-astrolib 2018.02.16+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | pro remchar,st,char ;Remove character
;+
; NAME:
; REMCHAR
; PURPOSE:
; Remove all appearances of character (char) from string (st)
;
; CALLING SEQUENCE:
; REMCHAR, ST, CHAR
;
; INPUT-OUTPUT:
; ST - String from which character will be removed, scalar or vector
; INPUT:
; CHAR- Single character to be removed from string or all elements of a
; string array
;
; EXAMPLE:
; If a = 'a,b,c,d,e,f,g' then
;
; IDL> remchar,a, ','
;
; will give a = 'abcdefg'
;
; REVISIONS HISTORY
; Written D. Lindler October 1986
; Test if empty string needs to be returned W. Landsman Feb 1991
; Work on string arrays W. Landsman August 1997
; Avoid 32 bit integer overflow K. Tolbert/W. Landsman Feb 2007
;-
compile_opt idl2
if N_params() LT 2 then begin
print,'Syntax - REMCHAR, string, character'
return
endif
bchar = byte(char) & bchar = bchar[0] ;Convert character to byte
for i = 0L,N_elements(st)-1 do begin
bst = byte(st[i])
good = where( bst NE bchar, Ngood)
if Ngood GT 0 then st[i] = string(bst[good]) else st[i] = ''
endfor
return
end
|