FUNCTION strpad, input_string, total_length, CLIP=clip ; Pad a string out to the size total_length ; If CLIP keyword is present then clip to the size as well, ; default is to give all chars if it is too long. in_len = STRLEN(input_string) if in_len GE total_length then begin ; string is already long enough (keep extra too) padded = input_string ; clip it to length if desired if KEYWORD_SET(CLIP) then begin padded = STRMID(padded,0,total_length) end end else begin padded = input_string for ip = 1, total_length - in_len do padded = padded + ' ' end RETURN, padded END