Calculator Community > The Axe Parser Project

Convert Number to String

(1/1)

Derbles:
Hey Everyone,

Is it possible to convert a number into a string?

For example, I have the String: "You found # $s"

Now I'm trying to replace the # with a number and replace the $ with a string.

It's trivial to replace the $, but I'm having trouble a number such as 25 into a string (list of chars).

Any thoughts?

Thanks!

Sorunome:
Axe has you covered!

You can do something like


--- Code: ---:Text "You found # "
:Text 25>Dec

--- End code ---

E37:
If you need the number as a string you can:

--- Code: ---:ClrHome
:Disp NUMBER >Dec
:Copy(L5, L1, 5)
:ClrHome
:0 -> {L1 + 5}

--- End code ---
That will save the number as a string in L1. It doesn't have to be L1 it can be any string. If the number is less than 5 digits long the string will start with space. So if the number was 354 the string would be "  354". Notice that the string has 2 spaces before the number.

The copy function can be used to take a "screenshot" of the homescreen. Copy(L5, POINTER, AMOUNT) would copy the AMOUNT of characters from the homescreen to POINTER. All the code does is display the number and copies the first 5 characters of the homescreen which happens to be the number that was displayed.

Navigation

[0] Message Index

Go to full version