FUNCTION qView_Shortname, str, seq ;+ ; NAME: ; qView_Shortname ; PURPOSE: ; Search for short hand representation for string array 'files' ; CATEGORY: ; Widget qImage ; CALLING SEQUENCE: ; R = qView_Shortname(str, seq) ; INPUTS: ; str array; type: string ; array of strings (usually a list of file names) ; OUTPUTS: ; R scalar; type: byte ; 0B: no short hand representation found ; (in this case 'seq' will not exist) ; 1B: short hand representation found ; seq array; type: string ; short hand representation. Will have the same ; length as the input array 'str'. ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; GetFileSpec ; PROCEDURE: ; Given a list of strings of equal length: ['xxayy','xxbyy','xxcyy','xxdyy'], ; the list ['a','b','c','d'] is returned, i.e. all common parts are removed and ; the residuals are returned. ; MODIFICATION HISTORY: ; JAN-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- f = GetFileSpec(str,part='name') n = strlen(f) IF n_elements( uniq(n) ) EQ 1 THEN BEGIN n = n[0] b = bytarr(n) FOR i=0,n-1 DO b[i] = n_elements( uniq(strmid(f,i,1)) ) NE 1 b1 = where(b) IF b1[0] NE -1 THEN BEGIN b2 = b1[n_elements(b1)-1] b1 = b1[0] nb = b2-b1+1 IF nb LT n AND nb EQ total(b) THEN seq = strmid(f,b1,nb) ENDIF ENDIF RETURN, n_elements(seq) NE 0 & END