Is there a way to ensure that the dollar sign is immediately to the left of an amount of money when output?
E.g.
X=12345
PRINT "$#####" : X
Prints $12345, which is fine.
But if X is 345 then it prints $ 345, inserting two spaces after the $ sign.
How can I ensure that the $ sign is immediately to the left of the first digit? In some versions of Basic using $$ solves the problem, but that doesn't appear to work in Smart Basic
Formatting money with a dollar sign
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Formatting money with a dollar sign
The simplest way is:
Code: Select all
x=345
print "$"&x