LB Booster
« USING formats »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:49am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: USING formats  (Read 481 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx USING formats
« Thread started on: Feb 1st, 2012, 5:01pm »

LB4's USING() function doesn't support the full range of formatting options usually available from PRINT USING in other dialects of BASIC. LBB provides a much more complete set, as follows:

#The hash character is used to represent a digit position.
+A plus sign at the beginning or end of the template string causes the sign (+ or -) to be printed before or after the number.
A minus sign at the end of the template string causes negative numbers to be printed with a trailing minus sign.
**A double asterisk at the beginning of the template string causes leading spaces to be filled with asterisks. The ** specifies two digit positions.
$$A double dollar (or £) sign at the beginning of the template string causes a dollar (or £) sign to be printed to the immediate left of the number.
**$A **$ (or **£) at the beginning of the template string combines the effects of the previous two formats.
,A comma to the left of the decimal point in the template string causes a comma to be printed between every third digit before the decimal point.
^^^^Four carets may be placed after the digit characters to specify exponential format.

For example:

Code:
print using("**$#,###.##-", -1234.567) ' **$1,234.57- 

Richard.
User IP Logged

JosephE
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 35
xx Re: USING formats
« Reply #1 on: Mar 14th, 2014, 6:11pm »

I also took the liberty of adding this to the wiki: Using() Format Extended Functionality.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls