25 lines
645 B
Plaintext
25 lines
645 B
Plaintext
PRINT
|
|
PRINT @str0$(1,4)
|
|
PRINT @str0$(-1,2)
|
|
PRINT @str0$(-1,3)
|
|
'
|
|
EDIT
|
|
'
|
|
FUNCTION str0$(n%,l&) !v1.00 correctly prints padded negative numbers
|
|
' works just like str$(num,len) but pads with '0' instread of white space
|
|
LOCAL p&
|
|
LOCAL r$
|
|
'
|
|
r$=REPLACE$(STR$(n%,l&),32,48) !-> '00-1' (needs fixed)
|
|
'
|
|
IF n%<0 !is it negative?
|
|
p&=INSTR(r$,"-") !position in padded string
|
|
IF p&>1 !not already at 1st char in padded string?
|
|
MID$(r$,p&,1)="0" !then move negative sign
|
|
MID$(r$,1,1)="-" ! to 1st char of padded string
|
|
ENDIF
|
|
ENDIF
|
|
'
|
|
RETURN r$
|
|
ENDFUNC
|