Dollar Formatting

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
lohill
Posts: 756
Joined: Tue Dec 08, 2009 6:37 pm
Location: San Diego, CA USA

Dollar Formatting

Post by lohill » Thu Dec 24, 2009 7:55 pm

If I have a variable that is a number like 43267.246, is there a variation of the format function that allows me to format it as $43,267.25? I could probably parse it out with a home made function but it would add overhead to the process.

Thanks,
Larry

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5145
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Dollar Formatting

Post by Mark » Thu Dec 24, 2009 8:54 pm

Hi Larry,

On this forum and in the archives of the Use Mail List, you'll find several ways to solve this problem. Just use the search features.

I haven't checked whether it actually works, but one of the many, many examples can be found here.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

whelkybaby
Posts: 47
Joined: Sat Nov 17, 2007 6:04 pm
Location: Worcester, UK

Re: Dollar Formatting

Post by whelkybaby » Thu Dec 24, 2009 10:23 pm

Hi Larry,

I've written a function that may suit your needs.

Take a look at http://theworcestersource.com/downloads ... fault.aspx and click on the download link for accountancyFormat().rev.

Hope that helps.

Cheers,


Steve
http://www.theworcestersource.com

lohill
Posts: 756
Joined: Tue Dec 08, 2009 6:37 pm
Location: San Diego, CA USA

Re: Dollar Formatting

Post by lohill » Fri Dec 25, 2009 12:29 am

Thanks Mark,

The routine you pointed me to will work very nicely. I had hoped there was a simple way rather than having to parse all the characters and do it myself. I'll be able to clean up what I saw to work just fine. My concern is that I don't want to burden down REV with unnecessary overhead. Do you find that it is as 'industrial strength' as advertised? Back in my HyperCard days I seem to remember concerns about slowing down the application with too many calculations.

You also mention the 'Use Mail List'. What is that and how do I access it? I'm getting acquainted with the Dictionary, The Resource Center and this Forum but searches through them for 'dollar' didn't yield much.

Best Regards,
Larry

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5145
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Dollar Formatting

Post by Mark » Fri Dec 25, 2009 7:44 pm

Larry,

Searching for "dollar" doesn't make sense, since the dollar is only one of many currencies and the script you need isn't just about dollars, not even necessarily about money.

You can subscribe for the use list here.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”