If we want to create fixed length fields using lots of spaces just doesn't look nice:
Code: Select all
Sequence_number Customer_number ____________ITEM____________ Value
--------------- --------------- ---------------------------- -----
1 20000 itemname1 100
2 30001 itemname2 200
Code: Select all
string1$="AA"
string2$="B"
numeric1.i=10
numeric2.i=200
Ljustified$=Left(string1$+" ",5)
Debug "_"+Ljustified$+"_"
Rjustified$=Right(" "+string2$, 5)
Debug "_"+Rjustified$+"_"
Ljustified$=Left(Str(numeric1)+" ",5)
Debug "_"+Ljustified$+"_"
Rjustified$=Right(" "+Str(numeric2), 5)
Debug "_"+Rjustified$+"_"
Code: Select all
_AA _
_ B_
_10 _
_ 200_
Code: Select all
f$fao("!5SL", number)
;total number of characters is 5 with 'number' added (same as Right(" "+Str(numeric), 5) )
; SL=leading space, ZL=leading zero
f$fao("!20AS"," ")
; inserts 20x spaces so we don't have to type them. Could be used in: Left(string$+f$fao("!100AS"," "),100) to justify left
Thanks.
Saso