home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-386-Vol-2of3.iso
/
b
/
baswiz19.zip
/
BW$BAS.ZIP
/
BCDSET.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-01-29
|
1KB
|
38 lines
' +----------------------------------------------------------------------+
' | |
' | BASWIZ Copyright (c) 1990-1993 Thomas G. Hanlin III |
' | |
' | The BASIC Wizard's Library |
' | |
' +----------------------------------------------------------------------+
DECLARE SUB BCDGetSize (LeftDigits AS INTEGER, RightDigits AS INTEGER)
DEFINT A-Z
FUNCTION BCDSet$ (NumSt$)
BCDGetSize LeftD, RightD
St$ = LTRIM$(NumSt$)
FOR tmp = 1 TO LEN(St$)
ch = ASC(MID$(St$, tmp, 1))
IF ch >= 48 AND ch <= 57 THEN MID$(St$, tmp, 1) = CHR$(ch - 48)
NEXT
IF LEFT$(St$, 1) = "-" THEN
Sign$ = "-"
St$ = MID$(St$, 2)
ELSE
Sign$ = " "
END IF
tmp = INSTR(St$, ".")
IF tmp THEN
L$ = LEFT$(St$, tmp - 1)
R$ = MID$(St$, tmp + 1)
ELSE
L$ = St$
R$ = ""
END IF
L$ = RIGHT$(STRING$(LeftD, 0) + L$, LeftD)
R$ = LEFT$(R$ + STRING$(RightD, 0), RightD)
BCDSet$ = Sign$ + L$ + R$
END FUNCTION