Jeff writes:
>
> I have added 2 new evaluator functions as part of the JXQ1 patch. These will
> become part of MPE 6.0 too.
>
> decimal(int) - takes an integer argument and returns the string equivalent.
> (could have used this yesterday! :)
Ugh...I'd have preferred ASC (like Debug/iX), or something (?) related to
some existing programming language!
Or...better yet... ASCII (###) --> "###"
PLEASE consider changing it! We don't need additional function/command names
that needlessly differ from existing ones!
Plus, when modelling after existing concepts, you get to leverage off of
interesting ideas. How about:
new CI function: ASCII
ASCII (n [, base] ) Returns a string with the number converted
to printable ASCII characters, in the specified
base. Examples:
calc ascii (123)
"123"
calc ascii (123, 16)
"7b"
(of course, calc doesn't print quote marks when
displaying strings ... I included them to
re-inforce the concept that ASCII returns a
string result)
If base is not 2, 8, 10, or 16, an error results.
and then expand it usefully:
ASCII (n, [, [base] [, [width] [, thousands-separator] ]])
As above, plus:
If thousands-separator is provided, then
that character will be inserted every 3
output digits:
ascii (12345, , , ",") --> "12,345"
If width is provided, and the resulting
string is LESS than ABS(width) then:
if width > 0 then
string has blanks padded on the LEFT
up to width characters.
if width < 0 then
string has blanks added on the RIGHT
up to width characters.
Example: ASCII (12, 10, 3) --> " 12"
ascii (12, 10, -3) --> "12 "
ascii (12, 10, 1) --> "1"
The last example shows that width is ignored if
it's less than necessary.
> I will add documentation about this patch on jazz sometime in the near
> future.
>
> regards,
> Jeff Vance, CSY
>
> --
>
--
Stan Sieler [log in to unmask]
http://www.allegro.com/sieler.html
|