Login
Back to forumReply to this topicGo to last reply

Posted By

SVS
on 2017-03-05
05:43:19
 PRINT USING / PUDEF

It seems that the filling character of a PRINT USING mask, does work only with numeric data (for example "****123"). Does anybody know a way to make it working in text data too? (For example "****ABCD").

Posted By

JamesC
on 2017-03-06
13:15:59
 Re: PRINT USING / PUDEF

10 A$="ABCDEFGHIJ"
20 PRINT USING "############";A$ : REM 12 # LEFT JUSTIFIED
30 PRINT USING "=###########";A$ : REM 11 # = CENTERED
40 PRINT USING ">###########";A$ : REM 11 # > RIGHT JUSTIFIED

You need one # for every desired output character. If your A$ is 10 characters long, but your PRINT USING only allows for 6 characters, it will only output the first 6 characters.

If your A$ is shorter than the PRINT USING statement, and you desire a different lead character instead of Space (ie, *s), build A$ with *'s instead of Spaces. ;)

Posted By

SVS
on 2017-03-08
12:02:01
 Re: PRINT USING / PUDEF

Yes James, but I was looking for an automatic way wink

Posted By

JamesC
on 2017-03-08
15:44:04
 Re: PRINT USING / PUDEF

Not strictly by PRINT USING. Though string splicing might qualify as "automatic".

10 PAD$="----------":REM 10 -
20 SKU$(1)="ZYXWVUT" : SKP(1)=1000.00
30 SKU$(2)="SRQP" : SKP(2)=99.99
40 SKU$(3)="NMLKJ" : SKP(3)=500.00
50 PUDEF "*.,E"
60 FOR ITEM=1 TO 3
70 : L = LEN(SKU$(ITEM))
80 : PD$ = RIGHT$(PAD$,9-L)
90 : LINE$ = PD$+SKU$(ITEM)
100 PRINT USING"#########"; LINE$; : PRINT , , : PRINT USING "#$###,###.##"; SKP(ITEM)
110 NEXT ITEM

wink



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024