HP Forums
How do you use format - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: How do you use format (/thread-6475.html)



How do you use format - StephenG1CMZ - 06-29-2016 09:41 PM

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.


RE: How do you use format - Joe Horn - 06-29-2016 10:12 PM

(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.


RE: How do you use format - roadrunner - 06-29-2016 10:14 PM

Try:

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

-road


RE: How do you use format (SOLVED) - StephenG1CMZ - 06-30-2016 07:12 AM

Thanks, both of those worked. I had tried CAS.format() instead of CAS(format()).


RE: How do you use format - toml_12953 - 06-30-2016 02:08 PM

(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