GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | SPACE

Edit History

SPACE

s = SPACE (n)

Home > Reference > String

Returns a string of n spaces.

SPACE is identical to SPC.

Example 1:

print "A" + space(5) + "B"    ' Output: A     B

Example 2: Insert string into a buffer

' s is a string ("" or longer); l is length of buffer (0+);
Def lset(s, l) = Left(s + Space(l), l) ' left justify text
Def rset(s, l) = Right(Space(l) + s, l) ' right justify text
Const buffer = 10 ' length of buffer

While True Do
  Color 7, 0: Cls
  Print "[ Using a buffer of "; buffer; " spaces ]"
  Print
  Input "Enter text into buffer (Enter 'S' to stop): ", text
  IF text = "S" Or text = "s" Then
    Stop
  Endif
  Color 7, 0: Locate 5, 0: Print "Left justified:  ";
  Color 0, 7: Print lset(text, buffer);
  Color 7, 0: Locate 7, 0: Print "Right justified: ";
  Color 0, 7: Print rset(text, buffer);
  Pause 
Wend
Code samples using SPACE
000 hello.bas   001 3 ways to print hello 5 times.bas   002 numeric variables.bas   agendus.bas   base64.bas   block.bas   bonkers.bas   bowling7.bas   calc.bas   dataminmax.bas   dmsareareadmd.bas   dogstar5.bas   draw rectangle.bas   drawpoly.bas   form demo.bas   g1 Life.bas   g2 Life.bas   g3 Life.bas   g4 Life.bas   g5 Life.bas   g6 Life.bas   hangman v2.bas   hangman.bas   hopalong copy.bas   hopalong.bas   index.bas   lander.bas   loadsavebmp_fltk.bas   memory match game.bas  
String
ASC   BCS   BIN   CBS   CHOP   CHR   DISCLOSE   ENCLOSE   FORMAT   HEX   INSTR   JOIN   LCASE   LEFT   LEFTOF   LEFTOFLAST   LOWER   LTRIM   MID   OCT   REPLACE   RIGHT   RIGHTOF   RIGHTOFLAST   RINSTR   RTRIM   SINPUT   SPACE   SPC   SPLIT   SPRINT   SQUEEZE   STR   STRING   TRANSLATE   TRIM   UCASE   UPPER   VAL  
This page was last edited on Fri, 11 Aug 2023 11:23:01 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.