Futurebasic/Language/Reference/unsstring

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Syntax[edit | edit source]

UNS$

Description[edit | edit source]

This function interprets the internal bit pattern of expr as an unsigned integer, then returns a string of decimal digits representing that integer's value. The length of the returned string depends on which of DEFSTR BYTE, DEFSTR WORD or DEFSTR LONG is currently in effect; the returned string may be padded on the left with one or more "0" characters, to make a string of the indicated length. If expr is a positive integer, then the number represented in the returned string will be the same as the value of expr (provided that the current DEFSTR mode allows UNS$ to return sufficient digits). If expr is a negative integer, then its internal bit pattern is different from that of an unsigned integer. In this case, the number represented in the returned string will be:

expr + 28, if DEFSTR BYTE is in effect;

expr + 216, if DEFSTR WORD is in effect;

expr + 232, if DEFSTR LONG is in effect.

Note: To convert a "signed integer" expression sexpr into an "unsigned integer" expression which has the same internal bit pattern, just assign sexpr to an unsigned integer variable. For example: myUnsLong&` = mySignedLong&

See Also[edit | edit source]

DEFSTR BYTE/WORD/LONG; HEX$; OCT$; BIN$; Appendix C: Data Types and Data Representation