Hello,
How can I display (SAY) the number 123456789 under the form 123.456.789 ?
Thank you
On 1/18/23 05:21, Jean-Louis Tourné wrote:
Hello,
How can I display (SAY) the number 123456789 under the form 123.456.789 ?
Thank you/******************************* 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/
Hello,
How can I display (SAY) the number 123456789 under the form 123.456.789 ?
Thank you
How can I display (SAY) the number 123456789 under the form 123.456.789 ?say translate('abc.def.ghi', 123456789, 'abcdefghi')
How can I display (SAY) the number 123456789 under the form 123.456.789 ?say translate('abc.def.ghi', 123456789, 'abcdefghi')
For the general case, covering also smaller numbers, you could use
say strip(translate('abc.def.ghi', 12345~right(9), 'abcdefghi'), 'l', ' .')
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 69:26:47 |
Calls: | 6,694 |
Calls today: | 4 |
Files: | 12,228 |
Messages: | 5,346,301 |
Posted today: | 1 |