/******************************* REXX *********************************/
/* REXX External Function written by Gerard Schildberger and */
/* uploaded to the comp.lang.rexx Usenet newsgroup on June 11, */
/* 2007 in response to a question from me. */
/* */
/* Arguments are: */
/* Comma(_, c, s, t) */
/* Where: */
/* _ = the input number to have commas inserted */
/* c = Character to be inserted (Default = ',') */
/* n = Number of spaces between "c" */
/* t = total insertions to perform (Default = 9999999) */
/**********************************************************************/
Parse Arg _, c, s, t
c = PickBlank(c, ',')
If \IsInt(s) | ,
s < 1 Then
s = 3
n = _ || '.9'
a = 123456789
k = 0
If \IsInt(t) Then
t = 9999999
Do j = Verify(n, a || '0', , Verify(n, a || '0.', 'M')) - s - 1 To ,
Verify(n, a, 'M') By -s While k < t
_ = Insert(c, _, j)
k = k + 1
End
Exit _
/**********************************************************************/
/* Subroutine to determine if a number is a whole number or not. */
/**********************************************************************/
IsInt:
Procedure
Return Datatype(Arg(1), 'W')
/**********************************************************************/
/* Subroutine to select the insertion character or blanks. */
/**********************************************************************/
PickBlank:
Procedure
Parse Arg x, y
Arg xu
If xu == 'BLANK' Then
Return ' '
Return Word(x y, 1)
--
Jaime A. Cruz
Nassau Wings Motorcycle Club
http://www.nassauwings.org/