; $Id: mkstrformat.pro,v 1.2 2002/01/14 20:59:26 amunter Exp $
FUNCTION mkstrformat, str, repcount=repcount
;+
;	NAME: mkstrformat
;	CALLING SEQUENCE: formstr=mkstrformat(str)
;		or: jim=STRING(str,FORMAT=mkstrformat(str))
;	PURPOSE: It returns an appropriate FORMAT string to specify a string
;		who's length is equal to the maximum length in str (if str is
;		an STRARR())
;		This is useful when printing out an array of strings, who's
;		intrinsic lengths vary, but which you would like to print out
;		equally spaced
;	KEYWORD PARAMETERS:
;		repcount = the repetition count. If it's equal to -1, then
;			repcount will be set equal to the number of elements in
;			the array of strings, str
;	MODIFICATION HISTORY:
;		Paul Schleger, Riso National Lab. 1993
;-
maxnum=max(strlen(str))
IF NOT keyword_set(repcount) THEN repcount=1
IF repcount EQ -1 THEN BEGIN
	IF isarray(str) THEN repcount = n_elements(str) ELSE repcount=1
END
jim=STRCOMPRESS('('+STRING(repcount,FORMAT='(I)')+'A'+STRING(maxnum,FORMAT='(I)')+')',$
	/REMOVE_ALL)
RETURN, jim
END
