LB Booster
« Non-standard thousands separators »

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: Non-standard thousands separators  (Read 288 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Non-standard thousands separators
« Thread started on: Nov 22nd, 2014, 09:47am »

I received this query by email:

Quote:
I tried to put 1221 in a format like: 1 221.000
The lower comma used locally as decimal point so I can't use it.

One of the LBB extensions is to format a number with 'thousands separators', but the only supported separator character is a comma - which as the OP says is used in some regions as the 'decimal point'. An easy way to achieve the desired result is firstly to format it with comma separators, and then change the commas to spaces:

Code:
print format$(1221)
end

function format$(number)
  format$ = using("#,###,###.###", number)
  do
    i = instr(format$, ",")
    if i then mid$(format$, i, 1) = " "
  loop until i = 0
end function 

Richard.
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