initial commit
This commit is contained in:
24
devtools/gbe/include/str0.lst
Normal file
24
devtools/gbe/include/str0.lst
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
Reference in New Issue
Block a user