rails number_to_currency将数字转换为当前区域下的货币表示
来源:互联网 发布:淘宝new balance 编辑:程序博客网 时间:2024/06/05 14:29
Instance Public methods
Formats a number
into a currency string (e.g., $13.65). Youcan customize the format in theoptions
hash.
Options
:locale
- Sets the locale to be used for formatting (defaultsto current locale).:precision
- Sets the level of precision (defaults to 2).:unit
- Sets the denomination of the currency (defaults to"$").:separator
- Sets the separator between the units (defaults to".").:delimiter
- Sets the thousands delimiter (defaults to ",").:format
- Sets the format for non-negative numbers (defaultsto "%u%n"). Fields are%u
for the currency, and%n
for the number.:negative_format
- Sets the format for negative numbers(defaults to prepending an hyphen to the formatted number given by:format
). Accepts the same fields than:format
,except%n
is here the absolute value of the number.
Examples
number_to_currency(1234567890.50) # => $1,234,567,890.50number_to_currency(1234567890.506) # => $1,234,567,890.51number_to_currency(1234567890.506, precision: 3) # => $1,234,567,890.506number_to_currency(1234567890.506, locale: :fr) # => 1 234 567 890,51 €number_to_currency('123a456') # => $123a456number_to_currency(-1234567890.50, negative_format: '(%u%n)')# => ($1,234,567,890.50)number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '')# => £1234567890,50number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '', format: '%n %u')# => 1234567890,50 £
- rails number_to_currency将数字转换为当前区域下的货币表示
- 将阿拉伯数字表示的货币数值转换成以中文大写表示的货币数值
- 把数字转换成中文货币表示
- 把数字转换成中文货币表示
- 一道面试题(把数字货币表示转换为大写表示,如把123.45转换为壹百贰拾叁元肆角伍分 )
- Excel2007表格中如何将一些表示概率的数字转换为百分数
- 将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分
- 将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分
- 将货币的小写转换为大写,例如:肆佰陆拾贰圆捌角柒分
- JS将数字转化为货币格式
- 任何数字转换为中文货币类型
- 货币数字转换为中文大写格式
- 将用户输入的小写货币形式转换为规范的大写货币形式
- 将用户输入的小写货币形式转换为规范的大写货币形式
- 将货币转换为大写VB
- 将数字转换为字符串的方法
- JS实现数字转换为货币汉字大写数字的方法详解
- 将一个数字表示为素数的乘积
- 【Tech-Android-Jni】Jni小精髓
- php多进程编程二
- Error处理:Java switch case 报错:case expressions must be constant expressions
- java的map
- 当ArcGIS遇到Netezza
- rails number_to_currency将数字转换为当前区域下的货币表示
- 提高MySQL在高并发情况下的负载
- VC++中GDI对象的释放问题
- LINUX web服务器首次被攻击(PHP木马怎么被挂进来的)解决思路
- Prototype与JQuery对比
- Linux中文件查找技术大全
- 不同版本(2.3,2.4,2.5)的Servlet web.xml 头信息
- CDN-Content Delivery Network
- simulation(模拟器) 与 emulation(仿真器)的区别