<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


N>S Search:

In String Words in TurboForth Kernal

Word Name: N>S
Type: Standard word
Data Stack Signature: n -- addr len
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Converts a number n from the stack into a string equivalent.

Example:

99 N>S TYPE

(displays 99)

32989 N>S TYPE

(displays -32547)

TRUE UNSIGNED !
32989 N>S TYPE

(displays 32989)

TRUE ZEROS !
44 N>S TYPE

(displays 00044)

Comment:

The address addr and length len of the string are pushed to the stack. The location of the newly created string should be considered transitory (for example, calling N>S again with a different value will overwrite the string).

The variable ZEROS is consulted when building the string. If TRUE (or any non-zero value) leading zeros will be included in the string.

If the number is negative a leading - sign will be included.

In V1.2 It is possible to force numbers to be interpreted as unsigned by setting the UNSIGNED variable to true.

See Also: ZEROS 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>