•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileSTR$(x[,y][,z])
BIN$(x[,y])
OCT$(x[,y])
HEX$(x[,y])

x, y, z: aexp

The functions STR$(), BIN$(), OCT$(), and HEX$() convert a numerical expression
into a character string.

The length of the required output string can be specified by a second
parameter. If necessary, it is padded at the front by blanks (STR$()) or zeros
(BIN$(), OCT$(), HEX$()). If the length specified is too short, only that
number of characters will be returned.

STR$() produces a string (base 10) from the number 'x', with 'y' specifying the
required length.

A further variant of STR$() is provided with the third parameter 'z'. The
number is formatted and rounded with 'y' characters and 'z' decimal places.

BIN$() converts an integer to Binary (base 2) representation. The optional
parameter 'y' specifies the number of character positions (1 to 32) to be used.

OCT$() converts an integer to Octal (base 8) representation. The optional
parameter 'y' specifies the number of character positions (1 to 11) to be used.

HEX$() converts an integer to Hexadecimal (base 16) representation. The
optional parameter 'y' specifies the number of character positions (1 to 8) to
be used.

Examples:

    a=123.4567
    PRINT STR$(a,6,2)
    PRINT STR$(PI,5,3)
    PRINT STR$(PI,2,2)

--> Prints the numbers 123.46, 3.142, and 14 on the screen.

    x=32+15
    a$=OCT$(16+7,4)
    PRINT HEX$(x),a$,BIN$(1+4+16+64,8)

--> Prints 2F, 0027, and 01010101 on the screen.

Memo: STR$() with 3 parameters is limited to 2000 characters for
      parameter 'y' in the editor and 400 characters compiled.