HP Forums

Full Version: How do you use format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do you use format to format numbers into strings?

Code:

EXPORT HOWFMT()
BEGIN
 MSGBOX(format(9.3456,"s3"));
END;

Gives a bad argument error.
(06-29-2016 09:41 PM)StephenG1CMZ Wrote: [ -> ]How do you use format to format numbers into strings?

The format command is a CAS command which Home doesn't know how to handle. So use CAS(format(9.3456,"s3")) when using it in a non-CAS program.
Try:

EXPORT HOWFMT()
BEGIN
MSGBOX(format(9.3456,QUOTE("s3")));
END;

-road
Thanks, both of those worked. I had tried CAS.format() instead of CAS(format()).
(06-30-2016 07:12 AM)StephenG1CMZ Wrote: [ -> ]Thanks, both of those worked. I had tried CAS.format() instead of CAS(format()).

When should I use CAS.command and when should I use CAS(command) ?

Tom L
Reference URL's