Repository navigation
Modern String MoneySetLocale
Paul Squires edited this page Nov 9, 2026
·
4 revisions
Home › String Library › String Library › MoneySetLocale
Forces the monetary settings to a named locale instead of the user's own. "" means the user's. Returns false if the system does not know the name.
MoneySetLocale( localeName ) as boolean- Names are platform-spelled:
"de-DE"on Windows,"de_DE.UTF-8"on Linux and macOS. - On Linux glibc only knows locales that have been GENERATED, so a perfectly valid name can still be rejected. That is what the false is for.
- When it returns false the formatter falls back to
.,,,3;0repeating, two fraction digits, symbol first, no space and sign before all. A symbol is never invented. - It rewrites the process-wide snapshot, so it is NOT thread-safe against a concurrent format. Call it at start-up, or while nothing is formatting.
- On Linux and macOS it asks for
LC_MONETARYalone, neverLC_ALL: widening it would moveLC_NUMERICtoo, andDecimalFromDoubleparsessnprintf( "%.14e" )output, so under a GermanLC_NUMERICevery double assigned to a MoneyFormat would silently become an invalid Decimal.
if MoneySetLocale( "de-DE" ) then
dim as MoneyFormat m = DecimalParse( "-1234.5" ).Value( )
print m.ToString( ) '' -1.234,50 €
end if
MoneySetLocale( "" ) '' back to the user's ownLibrary: String Library
Category: String Library
Documented under: Money Formatting
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing