;------------------------------------------------------------- ;+ ; NAME: ; PLURAL ; PURPOSE: ; Plural function: returns 's' if arg > 1, else ''. ; CATEGORY: ; CALLING SEQUENCE: ; c = plural(n) ; INPUTS: ; n = a number. in ; c = returned character: '' if n is 1, else 's'. out' ; KEYWORD PARAMETERS: ; Keywords: ; SINGLE=stxt Text to return if n is 1, def=''. ; PLURAL=ptxt Text to return if n is not 1, def='s'. ; OUTPUTS: ; COMMON BLOCKS: ; NOTES: ; Notes: Useful to get numeric related messages correct. ; Examples: print,strtrim(n,2)+' cow'+plural(n) ; print,strtrim(n,2)+' '+plural(n,single='ox',plural='oxen') ; MODIFICATION HISTORY: ; R. Sterner, 1995 Dec 14 ; ; Copyright (C) 1995, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ;- ;------------------------------------------------------------- function plural, n, single=sing, plural=plur, help=hlp if (n_params(0) lt 1) or keyword_set(hlp) then begin print," Plural function: returns 's' if arg > 1, else ''." print,' c = plural(n)' print,' n = a number. in' print," c = returned character: '' if n is 1, else 's'. out' print,' Keywords:' print," SINGLE=stxt Text to return if n is 1, def=''." print," PLURAL=ptxt Text to return if n is not 1, def='s'." print,' Notes: Useful to get numeric related messages correct.' print," Examples: print,strtrim(n,2)+' cow'+plural(n)" print," print,strtrim(n,2)+' '+plural(n,single='ox',plural='oxen')" return,'' endif if n_elements(sing) eq 0 then sing = '' if n_elements(plur) eq 0 then plur = 's' if n eq 1 then return,sing else return,plur end