Re: [sqlite] printf() - Local decilmal separator

2019-03-12 Thread James K. Lowden
On Tue, 12 Mar 2019 16:08:24 +
Alexandre Billon  wrote:

> 1st question : Is there a way to tell printf() to display the decimal
> separator set in the OS ?
> 
> For example, the decimal separator in my OS is set to comma (,), I
> would like printf() to display the comma as the decimal separator.

You may want to return the value in native form and use your C library
to format it.  Posix defines the single-quote character as a modifier
that does just what you want:


 ''' (apostrophe)
Decimal conversions (d, u, or i) or the integral portion of a
floating point conversion (f or F) should be grouped and
separated by thousands using the non-monetary separator
returned by localeconv(3).

--jkl
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] printf() - Local decilmal separator

2019-03-12 Thread Alexandre Billon
Hello,

1st question : Is there a way to tell printf() to display the decimal separator 
set in the OS ?

For example, the decimal separator in my OS is set to comma (,), I would like 
printf() to display the comma as the decimal separator.

sqlite> select printf('%.2f %%', 25.365419);
25.37 %

2nd question : Is there a way that printf displays thousand separators and 
decimal separators ?
sqlite> select printf('%,.2f %%', 25566425.365419);
25566425.37 %
sqlite> select printf('%,f %%', 25566425.365419);
25566425.365419 %
sqlite> select printf('%,d %%', 25566425.365419);
25,566,425 %

I haven't found anything here : https://www.sqlite.org/printf.html

Best Regards

Alex
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users