SPC
s = SPC (n)
Returns a string of n
spaces.
SPC is identical to SPACE.
Example 1:
print "A" + spc(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 + Spc(l), l) ' left justify text
Def rset(s, l) = Right(Spc(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 SPC
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
If there is insufficient information on this page and you wish learn more about SPC,
please send an email to smallbasic@gmail.com. You can help to improve information about
SPC by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.