New topic: Numeric format independent of regional configuration
<http://forums.realsoftware.com/viewtopic.php?t=46279> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message nicokne Post subject: Numeric format independent of regional configurationPosted: Tue Dec 18, 2012 12:59 pm Joined: Wed Jun 27, 2012 3:26 pm Posts: 23 Location: argentina Hi everyone! I want to show a number with a special format. I tried all i know, but i don't succeed. For example, i want to show 33258213 as 33.258.213 ALWAYS the same way, independent of regional configuration, and the decimal separator will be the "," character so a number enter as 21812.32 i want to display it ALWAYS and with every regional configuration as 21.812,32 I used the Format() function but the returned string varies depending of the regional configuration How could i solve this? THANKS!! I use windows 7 and realbasic 2012r2 Top jakuno Post subject: Re: Numeric format independent of regional configurationPosted: Tue Dec 18, 2012 1:54 pm Joined: Fri Aug 31, 2012 3:56 pm Posts: 42 try: Function Format_German(d as double, fmt as string) As string dim Sepeator_Decimal as string = format(1.2, "0.0").Mid(2, 1) dim Sepeator_Thousend as string = format(1000, "#,#").Mid(2, 1) if Sepeator_Decimal = "," AND Sepeator_Thousend = "." then Return format(d, fmt) else Return format(d, fmt).ReplaceAll(Sepeator_Decimal, chr(8)).ReplaceAll(Sepeator_Thousend, ".").ReplaceAll(chr(8), ",") end if End Function Top mjh Post subject: Re: Numeric format independent of regional configurationPosted: Tue Dec 18, 2012 2:41 pm Joined: Sun Feb 19, 2006 3:10 pm Posts: 1580 Location: Hamburg, Germany You can use Str which supports the same parameters that Format does but always uses the US format. With that as a fixed starting point it is easy to convert the string to whatever format you like. _________________ Michael J. HuÃmann http://digicam-experts.de Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
