money 3.5.4 → 3.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +18 -0
- data/lib/money/bank/variable_exchange.rb +1 -1
- data/lib/money/currency.rb +189 -175
- data/lib/money/money.rb +167 -85
- metadata +3 -10
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
Money 3.5.5
|
2
|
+
===========
|
3
|
+
|
4
|
+
Features
|
5
|
+
--------
|
6
|
+
- Enhancements to Money::Currency (thanks Matthew McEachen)
|
7
|
+
- Replace delimiter with thousands_separator
|
8
|
+
- Replace separator with decimal_mark
|
9
|
+
- Added symbol_first and html_entity
|
10
|
+
- Added allocation algorithm for fair(ish) splitting of money between parties
|
11
|
+
without loosing pennies (thanks Tobias Luetke)
|
12
|
+
|
13
|
+
Bugfixes
|
14
|
+
--------
|
15
|
+
- Always store cents as an Integer (thanks Abhay Kumar)
|
16
|
+
- Fixed TypeError in rate exchange (thanks Christian Billen)
|
17
|
+
- Cleanup #parse (thanks Tom Lianza)
|
18
|
+
|
1
19
|
Money 3.5.4
|
2
20
|
===========
|
3
21
|
|
@@ -81,7 +81,7 @@ class Money
|
|
81
81
|
end
|
82
82
|
_to_currency_ = Currency.wrap(to_currency)
|
83
83
|
|
84
|
-
cents = from.cents / (BigDecimal.new(from.currency.subunit_to_unit.to_s) / BigDecimal.new(_to_currency_.subunit_to_unit.to_s))
|
84
|
+
cents = BigDecimal.new(from.cents.to_s) / (BigDecimal.new(from.currency.subunit_to_unit.to_s) / BigDecimal.new(_to_currency_.subunit_to_unit.to_s))
|
85
85
|
|
86
86
|
ex = cents * BigDecimal.new(rate.to_s)
|
87
87
|
ex = ex.to_f
|
data/lib/money/currency.rb
CHANGED
@@ -9,9 +9,6 @@ class Money
|
|
9
9
|
# Thrown when an unknown currency is requested.
|
10
10
|
class UnknownCurrency < StandardError; end
|
11
11
|
|
12
|
-
# List of attributes applicable to a currency object.
|
13
|
-
ATTRIBUTES = [ :priority, :iso_code, :name, :symbol, :subunit, :subunit_to_unit, :separator, :delimiter ]
|
14
|
-
|
15
12
|
# List of known currencies.
|
16
13
|
#
|
17
14
|
# == monetary unit
|
@@ -21,176 +18,179 @@ class Money
|
|
21
18
|
# A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit
|
22
19
|
# http://www.answers.com/topic/fractional-monetary-unit-subunit
|
23
20
|
#
|
24
|
-
# See http://en.wikipedia.org/wiki/List_of_circulating_currencies
|
21
|
+
# See http://en.wikipedia.org/wiki/List_of_circulating_currencies and
|
22
|
+
# http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
|
23
|
+
|
25
24
|
TABLE = {
|
26
|
-
:aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :
|
27
|
-
:afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :
|
28
|
-
:all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :
|
29
|
-
:amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :
|
30
|
-
:ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :
|
31
|
-
:aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :
|
32
|
-
:ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
33
|
-
:aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
34
|
-
:awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :
|
35
|
-
:azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :
|
36
|
-
:bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :
|
37
|
-
:bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
38
|
-
:bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :
|
39
|
-
:bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :
|
40
|
-
:bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils",
|
41
|
-
:bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
42
|
-
:bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
43
|
-
:bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :
|
44
|
-
:bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :
|
45
|
-
:brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo",
|
46
|
-
:bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
47
|
-
:btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :
|
48
|
-
:bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :
|
49
|
-
:byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :
|
50
|
-
:bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
51
|
-
:cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
52
|
-
:cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
53
|
-
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :
|
54
|
-
:clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :
|
55
|
-
:cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Jiao", :subunit_to_unit => 10, :
|
56
|
-
:cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
57
|
-
:crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :
|
58
|
-
:cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
59
|
-
:cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
60
|
-
:cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :
|
61
|
-
:czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :
|
62
|
-
:djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
63
|
-
:dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :
|
64
|
-
:dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
65
|
-
:dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :
|
66
|
-
:eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :
|
67
|
-
:egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :
|
68
|
-
:ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :
|
69
|
-
:etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :
|
70
|
-
:eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :
|
71
|
-
:fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
72
|
-
:fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :
|
73
|
-
:gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :
|
74
|
-
:gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :
|
75
|
-
:ghs => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :
|
76
|
-
:gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :
|
77
|
-
:gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :
|
78
|
-
:gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
79
|
-
:gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :
|
80
|
-
:gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
81
|
-
:hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit => 100, :
|
82
|
-
:hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :
|
83
|
-
:hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :
|
84
|
-
:htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :
|
85
|
-
:huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :
|
86
|
-
:idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :
|
87
|
-
:ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :
|
88
|
-
:inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :
|
89
|
-
:iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :
|
90
|
-
:irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :
|
91
|
-
:isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :
|
92
|
-
:jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
93
|
-
:jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :
|
94
|
-
:jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :
|
95
|
-
:kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :
|
96
|
-
:kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :
|
97
|
-
:khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :
|
98
|
-
:kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
99
|
-
:kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :
|
100
|
-
:krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :
|
101
|
-
:kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils",
|
102
|
-
:kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
103
|
-
:kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :
|
104
|
-
:lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :
|
105
|
-
:lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre",
|
106
|
-
:lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :
|
107
|
-
:lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
108
|
-
:lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :
|
109
|
-
:ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :
|
110
|
-
:lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :
|
111
|
-
:lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham",
|
112
|
-
:mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :
|
113
|
-
:mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :
|
114
|
-
:mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :
|
115
|
-
:mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :
|
116
|
-
:mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :
|
117
|
-
:mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :
|
118
|
-
:mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :
|
119
|
-
:mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :
|
120
|
-
:mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :
|
121
|
-
:mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :
|
122
|
-
:mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :
|
123
|
-
:mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
124
|
-
:myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :
|
125
|
-
:mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :
|
126
|
-
:nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
127
|
-
:ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :
|
128
|
-
:nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :
|
129
|
-
:nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :
|
130
|
-
:npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :
|
131
|
-
:nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
132
|
-
:omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa",
|
133
|
-
:pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :
|
134
|
-
:pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :
|
135
|
-
:pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :
|
136
|
-
:php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :
|
137
|
-
:pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :
|
138
|
-
:pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :
|
139
|
-
:pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :
|
140
|
-
:qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :
|
141
|
-
:ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :
|
142
|
-
:rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :
|
143
|
-
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :
|
144
|
-
:rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
145
|
-
:sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah",
|
146
|
-
:sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
147
|
-
:scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :
|
148
|
-
:sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :
|
149
|
-
:sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :
|
150
|
-
:sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
151
|
-
:shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :
|
152
|
-
:skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :
|
153
|
-
:sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :
|
154
|
-
:sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :
|
155
|
-
:srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
156
|
-
:std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :
|
157
|
-
:svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :
|
158
|
-
:syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س",
|
159
|
-
:szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :
|
160
|
-
:thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :
|
161
|
-
:tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :
|
162
|
-
:tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :
|
163
|
-
:tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :
|
164
|
-
:top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :
|
165
|
-
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit => 100, :
|
166
|
-
:ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
167
|
-
:twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
168
|
-
:tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :
|
169
|
-
:uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :
|
170
|
-
:ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :
|
171
|
-
:usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
172
|
-
:uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :
|
173
|
-
:uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :
|
174
|
-
:vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :
|
175
|
-
:vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :
|
176
|
-
:vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :
|
177
|
-
:wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :
|
178
|
-
:xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
179
|
-
:xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
180
|
-
:xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
181
|
-
:xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :
|
182
|
-
:yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :
|
183
|
-
:zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :
|
184
|
-
:zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :
|
185
|
-
:zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :
|
25
|
+
:aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
26
|
+
:afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
27
|
+
:all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
28
|
+
:amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
29
|
+
:ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "ƒ", :decimal_mark => ",", :thousands_separator => "."},
|
30
|
+
:aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
31
|
+
:ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
32
|
+
:aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
33
|
+
:awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "ƒ", :decimal_mark => ".", :thousands_separator => ","},
|
34
|
+
:azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
35
|
+
:bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
36
|
+
:bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
37
|
+
:bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
38
|
+
:bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
39
|
+
:bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
40
|
+
:bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
41
|
+
:bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
42
|
+
:bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
43
|
+
:bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
44
|
+
:brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "R\$", :decimal_mark => ",", :thousands_separator => "."},
|
45
|
+
:bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
46
|
+
:btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
47
|
+
:bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
48
|
+
:byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
49
|
+
:bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
50
|
+
:cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
51
|
+
:cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
52
|
+
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
53
|
+
:clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
54
|
+
:cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Jiao", :subunit_to_unit => 10, :symbol_first => true, :html_entity => "圓", :decimal_mark => ".", :thousands_separator => ","},
|
55
|
+
:cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
56
|
+
:crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₡", :decimal_mark => ",", :thousands_separator => "."},
|
57
|
+
:cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
58
|
+
:cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
59
|
+
:cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
60
|
+
:czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
61
|
+
:djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
62
|
+
:dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
63
|
+
:dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
64
|
+
:dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
65
|
+
:eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
66
|
+
:egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
67
|
+
:ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
68
|
+
:etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
69
|
+
:eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "€", :decimal_mark => ",", :thousands_separator => "."},
|
70
|
+
:fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
71
|
+
:fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
72
|
+
:gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
73
|
+
:gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
74
|
+
:ghs => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₵", :decimal_mark => ".", :thousands_separator => ","},
|
75
|
+
:gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
76
|
+
:gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
77
|
+
:gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
78
|
+
:gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
79
|
+
:gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
80
|
+
:hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
81
|
+
:hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
82
|
+
:hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
83
|
+
:htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
84
|
+
:huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
85
|
+
:idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
86
|
+
:ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₪", :decimal_mark => ".", :thousands_separator => ","},
|
87
|
+
:inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
88
|
+
:iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
89
|
+
:irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
90
|
+
:isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
91
|
+
:jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
92
|
+
:jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
93
|
+
:jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "¥", :decimal_mark => ".", :thousands_separator => ","},
|
94
|
+
:kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
95
|
+
:kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
96
|
+
:khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "៛", :decimal_mark => ".", :thousands_separator => ","},
|
97
|
+
:kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
98
|
+
:kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₩", :decimal_mark => ".", :thousands_separator => ","},
|
99
|
+
:krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₩", :decimal_mark => ".", :thousands_separator => ","},
|
100
|
+
:kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
101
|
+
:kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
102
|
+
:kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
103
|
+
:lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₭", :decimal_mark => ".", :thousands_separator => ","},
|
104
|
+
:lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
105
|
+
:lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "௹", :decimal_mark => ".", :thousands_separator => ","},
|
106
|
+
:lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
107
|
+
:lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
108
|
+
:ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
109
|
+
:lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
110
|
+
:lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
111
|
+
:mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
112
|
+
:mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
113
|
+
:mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
114
|
+
:mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
115
|
+
:mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
116
|
+
:mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₮", :decimal_mark => ".", :thousands_separator => ","},
|
117
|
+
:mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
118
|
+
:mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
119
|
+
:mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
120
|
+
:mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
121
|
+
:mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
122
|
+
:mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
123
|
+
:myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
124
|
+
:mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
125
|
+
:nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
126
|
+
:ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₦", :decimal_mark => ".", :thousands_separator => ","},
|
127
|
+
:nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
128
|
+
:nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "kr", :decimal_mark => ",", :thousands_separator => "."},
|
129
|
+
:npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
130
|
+
:nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
131
|
+
:omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
132
|
+
:pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
133
|
+
:pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "S/.", :decimal_mark => ".", :thousands_separator => ","},
|
134
|
+
:pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
135
|
+
:php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
136
|
+
:pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
137
|
+
:pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
138
|
+
:pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₲", :decimal_mark => ".", :thousands_separator => ","},
|
139
|
+
:qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
140
|
+
:ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
141
|
+
:rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
142
|
+
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "руб", :decimal_mark => ",", :thousands_separator => "."},
|
143
|
+
:rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
144
|
+
:sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
145
|
+
:sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
146
|
+
:scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
147
|
+
:sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
148
|
+
:sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
149
|
+
:sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
150
|
+
:shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
151
|
+
:skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
152
|
+
:sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
153
|
+
:sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
154
|
+
:srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
155
|
+
:std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
156
|
+
:svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₡", :decimal_mark => ".", :thousands_separator => ","},
|
157
|
+
:syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
158
|
+
:szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
159
|
+
:thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "฿", :decimal_mark => ".", :thousands_separator => ","},
|
160
|
+
:tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
161
|
+
:tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
162
|
+
:tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
163
|
+
:top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
164
|
+
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
165
|
+
:ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
166
|
+
:twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
167
|
+
:tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
168
|
+
:uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "₴", :decimal_mark => ".", :thousands_separator => ","},
|
169
|
+
:ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
170
|
+
:usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
171
|
+
:uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
172
|
+
:uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
173
|
+
:vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
174
|
+
:vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :symbol_first => true, :html_entity => "₫", :decimal_mark => ",", :thousands_separator => "."},
|
175
|
+
:vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
176
|
+
:wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
177
|
+
:xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
178
|
+
:xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
179
|
+
:xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
180
|
+
:xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
181
|
+
:yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
182
|
+
:zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "R", :decimal_mark => ".", :thousands_separator => ","},
|
183
|
+
:zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
184
|
+
:zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
186
185
|
|
187
186
|
# aliases for BC with documentation before Currency
|
188
|
-
:yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :
|
187
|
+
:yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "¥", :decimal_mark => ".", :thousands_separator => ","},
|
189
188
|
|
190
189
|
# kept for backwards compatibility, real entry is :ghs
|
191
|
-
:ghc => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :
|
190
|
+
:ghc => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "₵", :decimal_mark => ".", :thousands_separator => "," }
|
192
191
|
}
|
193
192
|
|
193
|
+
|
194
194
|
# The symbol used to identify the currency, usually the lowercase
|
195
195
|
# +iso_code+ attribute.
|
196
196
|
#
|
@@ -217,6 +217,11 @@ class Money
|
|
217
217
|
# @return [String]
|
218
218
|
attr_reader :symbol
|
219
219
|
|
220
|
+
# The html entity for the currency symbol
|
221
|
+
#
|
222
|
+
# @return [String]
|
223
|
+
attr_reader :html_entity
|
224
|
+
|
220
225
|
# The name of the fractional monetary unit.
|
221
226
|
#
|
222
227
|
# @return [String]
|
@@ -227,15 +232,26 @@ class Money
|
|
227
232
|
# @return [Integer]
|
228
233
|
attr_reader :subunit_to_unit
|
229
234
|
|
230
|
-
# The character used to separate the whole unit from the subunit.
|
235
|
+
# The decimal mark, or character used to separate the whole unit from the subunit.
|
231
236
|
#
|
232
237
|
# @return [String]
|
233
|
-
attr_reader :
|
238
|
+
attr_reader :decimal_mark
|
239
|
+
alias :separator :decimal_mark
|
234
240
|
|
235
241
|
# The character used to separate thousands grouping of the whole unit.
|
236
242
|
#
|
237
243
|
# @return [String]
|
238
|
-
attr_reader :
|
244
|
+
attr_reader :thousands_separator
|
245
|
+
alias :delimiter :thousands_separator
|
246
|
+
|
247
|
+
# Should the currency symbol precede the amount, or should it come after?
|
248
|
+
#
|
249
|
+
# @return [boolean]
|
250
|
+
attr_reader :symbol_first
|
251
|
+
|
252
|
+
def symbol_first?
|
253
|
+
!!@symbol_first
|
254
|
+
end
|
239
255
|
|
240
256
|
# The number of decimal places needed.
|
241
257
|
#
|
@@ -262,8 +278,8 @@ class Money
|
|
262
278
|
def initialize(id)
|
263
279
|
@id = id.to_s.downcase.to_sym
|
264
280
|
data = TABLE[@id] || raise(UnknownCurrency, "Unknown currency `#{id}'")
|
265
|
-
|
266
|
-
instance_variable_set(:"@#{
|
281
|
+
data.each_pair do |key, value|
|
282
|
+
instance_variable_set(:"@#{key}", value)
|
267
283
|
end
|
268
284
|
end
|
269
285
|
|
@@ -350,7 +366,7 @@ class Money
|
|
350
366
|
# @example
|
351
367
|
# Money::Currency.new(:usd) #=> #<Currency id: usd ...>
|
352
368
|
def inspect
|
353
|
-
"#<#{self.class.name} id: #{id} #{
|
369
|
+
"#<#{self.class.name} id: #{id}, priority: #{priority}, symbol_first: #{symbol_first}, thousands_separator: #{thousands_separator}, html_entity: #{html_entity}, decimal_mark: #{decimal_mark}, name: #{name}, symbol: #{symbol}, subunit_to_unit: #{subunit_to_unit}, iso_code: #{iso_code}, subunit: #{subunit}>"
|
354
370
|
end
|
355
371
|
|
356
372
|
# Class Methods
|
@@ -369,9 +385,7 @@ class Money
|
|
369
385
|
# Money::Currency.find(:foo) #=> nil
|
370
386
|
def find(id)
|
371
387
|
id = id.to_s.downcase.to_sym
|
372
|
-
if
|
373
|
-
new(id)
|
374
|
-
end
|
388
|
+
new(id) if self::TABLE[id]
|
375
389
|
end
|
376
390
|
|
377
391
|
# Wraps the object in a +Currency+ unless it's already a +Currency+
|
data/lib/money/money.rb
CHANGED
@@ -386,7 +386,7 @@ class Money
|
|
386
386
|
# @see Money.new_with_dollars
|
387
387
|
#
|
388
388
|
def initialize(cents, currency = Money.default_currency, bank = Money.default_bank)
|
389
|
-
@cents = cents.round
|
389
|
+
@cents = cents.round.to_i
|
390
390
|
@currency = Currency.wrap(currency)
|
391
391
|
@bank = bank
|
392
392
|
end
|
@@ -713,22 +713,23 @@ class Money
|
|
713
713
|
end
|
714
714
|
|
715
715
|
# If I18n is loaded, looks up key +:number.format.delimiter+.
|
716
|
-
# Otherwise and as fallback it uses +Currency#
|
716
|
+
# Otherwise and as fallback it uses +Currency#thousands_separator+.
|
717
717
|
# If +nil+ is returned, default to ",".
|
718
718
|
#
|
719
719
|
# @return [String]
|
720
720
|
#
|
721
721
|
# @example
|
722
|
-
# Money.new(100, "USD").
|
722
|
+
# Money.new(100, "USD").thousands_separator #=> ","
|
723
723
|
if Object.const_defined?("I18n")
|
724
|
-
def
|
725
|
-
I18n.t(:"number.format.
|
724
|
+
def thousands_separator
|
725
|
+
I18n.t(:"number.format.thousands_separator", :default => currency.thousands_separator || ",")
|
726
726
|
end
|
727
727
|
else
|
728
|
-
def
|
729
|
-
currency.
|
728
|
+
def thousands_separator
|
729
|
+
currency.thousands_separator || ","
|
730
730
|
end
|
731
731
|
end
|
732
|
+
alias :delimiter :thousands_separator
|
732
733
|
|
733
734
|
# If I18n is loaded, looks up key +:number.format.seperator+.
|
734
735
|
# Otherwise and as fallback it uses +Currency#seperator+.
|
@@ -737,16 +738,17 @@ class Money
|
|
737
738
|
# @return [String]
|
738
739
|
#
|
739
740
|
# @example
|
740
|
-
# Money.new(100, "USD").
|
741
|
+
# Money.new(100, "USD").decimal_mark #=> "."
|
741
742
|
if Object.const_defined?("I18n")
|
742
|
-
def
|
743
|
-
I18n.t(:"number.format.
|
743
|
+
def decimal_mark
|
744
|
+
I18n.t(:"number.format.decimal_mark", :default => currency.decimal_mark || ".")
|
744
745
|
end
|
745
746
|
else
|
746
|
-
def
|
747
|
-
currency.
|
747
|
+
def decimal_mark
|
748
|
+
currency.decimal_mark || "."
|
748
749
|
end
|
749
750
|
end
|
751
|
+
alias :separator :decimal_mark
|
750
752
|
|
751
753
|
# Creates a formatted price string according to several rules.
|
752
754
|
#
|
@@ -803,31 +805,31 @@ class Money
|
|
803
805
|
# # You can specify a string as value to enforce using a particular symbol.
|
804
806
|
# Money.new(100, "AWG").format(:symbol => "ƒ") #=> "ƒ1.00"
|
805
807
|
#
|
806
|
-
# @option *rules [Boolean, String, nil] :
|
808
|
+
# @option *rules [Boolean, String, nil] :decimal_mark (true) Whether the
|
807
809
|
# currency should be separated by the specified character or '.'
|
808
810
|
#
|
809
811
|
# @example
|
810
812
|
# # If a string is specified, it's value is used.
|
811
|
-
# Money.new(100, "USD").format(:
|
813
|
+
# Money.new(100, "USD").format(:decimal_mark => ",") #=> "$1,00"
|
812
814
|
#
|
813
|
-
# # If the
|
814
|
-
# # to "." as
|
815
|
+
# # If the decimal_mark for a given currency isn't known, then it will default
|
816
|
+
# # to "." as decimal_mark.
|
815
817
|
# Money.new(100, "FOO").format #=> "$1.00"
|
816
818
|
#
|
817
|
-
# @option *rules [Boolean, String, nil] :
|
818
|
-
# currency should be delimited by the specified character or ','
|
819
|
+
# @option *rules [Boolean, String, nil] :thousands_separator (true) Whether
|
820
|
+
# the currency should be delimited by the specified character or ','
|
819
821
|
#
|
820
822
|
# @example
|
821
|
-
# # If false is specified, no
|
822
|
-
# Money.new(100000, "USD").format(:
|
823
|
-
# Money.new(100000, "USD").format(:
|
824
|
-
# Money.new(100000, "USD").format(:
|
823
|
+
# # If false is specified, no thousands_separator is used.
|
824
|
+
# Money.new(100000, "USD").format(:thousands_separator => false) #=> "1000.00"
|
825
|
+
# Money.new(100000, "USD").format(:thousands_separator => nil) #=> "1000.00"
|
826
|
+
# Money.new(100000, "USD").format(:thousands_separator => "") #=> "1000.00"
|
825
827
|
#
|
826
828
|
# # If a string is specified, it's value is used.
|
827
|
-
# Money.new(100000, "USD").format(:
|
829
|
+
# Money.new(100000, "USD").format(:thousands_separator => ".") #=> "$1.000.00"
|
828
830
|
#
|
829
|
-
# # If the
|
830
|
-
# # to "," as
|
831
|
+
# # If the thousands_separator for a given currency isn't known, then it will
|
832
|
+
# # default to "," as thousands_separator.
|
831
833
|
# Money.new(100000, "FOO").format #=> "$1,000.00"
|
832
834
|
#
|
833
835
|
# @option *rules [Boolean] :html (false) Whether the currency should be
|
@@ -848,41 +850,46 @@ class Money
|
|
848
850
|
end
|
849
851
|
end
|
850
852
|
|
851
|
-
|
852
|
-
if rules
|
853
|
-
|
854
|
-
|
855
|
-
|
853
|
+
symbol_value =
|
854
|
+
if rules.has_key?(:symbol)
|
855
|
+
if rules[:symbol] === true
|
856
|
+
symbol
|
857
|
+
elsif rules[:symbol]
|
858
|
+
rules[:symbol]
|
859
|
+
else
|
860
|
+
""
|
861
|
+
end
|
862
|
+
elsif rules[:html]
|
863
|
+
currency.html_entity
|
856
864
|
else
|
857
|
-
|
865
|
+
symbol
|
858
866
|
end
|
859
|
-
else
|
860
|
-
symbol_value = symbol
|
861
|
-
end
|
862
867
|
|
863
868
|
formatted = case rules[:no_cents]
|
864
869
|
when true
|
865
|
-
"#{
|
870
|
+
"#{self.to_s.to_i}"
|
866
871
|
else
|
867
|
-
"#{
|
872
|
+
"#{self.to_s}"
|
868
873
|
end
|
869
|
-
|
870
|
-
|
871
|
-
|
874
|
+
formatted = (currency.symbol_first? ? "#{symbol_value}#{formatted}" : "#{formatted} #{symbol_value}") unless symbol_value.nil? or symbol_value.empty?
|
875
|
+
|
876
|
+
if rules.has_key?(:decimal_mark) and rules[:decimal_mark] and
|
877
|
+
rules[:decimal_mark] != decimal_mark
|
878
|
+
formatted.sub!(decimal_mark, rules[:decimal_mark])
|
872
879
|
end
|
873
880
|
|
874
|
-
|
875
|
-
# Determine
|
876
|
-
if rules.has_key?(:
|
877
|
-
if rules[:
|
878
|
-
|
879
|
-
elsif rules[:
|
880
|
-
|
881
|
+
thousands_separator_value = thousands_separator
|
882
|
+
# Determine thousands_separator
|
883
|
+
if rules.has_key?(:thousands_separator)
|
884
|
+
if rules[:thousands_separator] === false or rules[:thousands_separator].nil?
|
885
|
+
thousands_separator_value = ""
|
886
|
+
elsif rules[:thousands_separator]
|
887
|
+
thousands_separator_value = rules[:thousands_separator]
|
881
888
|
end
|
882
889
|
end
|
883
890
|
|
884
|
-
# Apply
|
885
|
-
formatted.gsub!(/(\d)(?=(?:\d{3})+(?:\.|,|$))(\d{3}\..*)?/, "\\1#{
|
891
|
+
# Apply thousands_separator
|
892
|
+
formatted.gsub!(/(\d)(?=(?:\d{3})+(?:\.|,|$))(\d{3}\..*)?/, "\\1#{thousands_separator_value}\\2")
|
886
893
|
|
887
894
|
if rules[:with_currency]
|
888
895
|
formatted << " "
|
@@ -906,8 +913,8 @@ class Money
|
|
906
913
|
return unit
|
907
914
|
end
|
908
915
|
subunit = (("0" * currency.decimal_places) + subunit)[(-1*currency.decimal_places)..-1]
|
909
|
-
return "-#{unit}#{
|
910
|
-
"#{unit}#{
|
916
|
+
return "-#{unit}#{decimal_mark}#{subunit}" if cents < 0
|
917
|
+
"#{unit}#{decimal_mark}#{subunit}"
|
911
918
|
end
|
912
919
|
|
913
920
|
# Return the amount of money as a float. Floating points cannot guarantee
|
@@ -980,6 +987,65 @@ class Money
|
|
980
987
|
self
|
981
988
|
end
|
982
989
|
|
990
|
+
# Common inspect function
|
991
|
+
#
|
992
|
+
# @return [String]
|
993
|
+
def inspect
|
994
|
+
"#<Money cents:#{cents} currency:#{currency}>"
|
995
|
+
end
|
996
|
+
|
997
|
+
# Allocates money between different parties without loosing pennies.
|
998
|
+
# After the mathmatically split has been performed, left over pennies will
|
999
|
+
# be distributed round-robin amongst the parties. This means that parties
|
1000
|
+
# listed first will likely recieve more pennies then ones that are listed later
|
1001
|
+
#
|
1002
|
+
# @param [0.50, 0.25, 0.25] to give 50% of the cash to party1, 25% ot party2, and 25% to party3.
|
1003
|
+
#
|
1004
|
+
# @return [Array<Money, Money, Money>]
|
1005
|
+
#
|
1006
|
+
# @example
|
1007
|
+
# Money.new(5, "USD").allocate([0.3,0.7)) #=> [Money.new(2), Money.new(3)]
|
1008
|
+
# Money.new(100, "USD").allocate([0.33,0.33,0.33]) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
1009
|
+
def allocate(splits)
|
1010
|
+
allocations = splits.inject(0.0) {|sum, i| sum += i }
|
1011
|
+
raise ArgumentError, "splits add to more then 100%" if allocations > 1.0
|
1012
|
+
|
1013
|
+
left_over = cents
|
1014
|
+
|
1015
|
+
amounts = splits.collect do |ratio|
|
1016
|
+
fraction = (cents * ratio / allocations).floor
|
1017
|
+
left_over -= fraction
|
1018
|
+
fraction
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
left_over.times { |i| amounts[i % amounts.length] += 1 }
|
1022
|
+
|
1023
|
+
return amounts.collect { |cents| Money.new(cents, currency) }
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
# Split money amongst parties evenly without loosing pennies.
|
1027
|
+
#
|
1028
|
+
# @param [2] number of parties.
|
1029
|
+
#
|
1030
|
+
# @return [Array<Money, Money, Money>]
|
1031
|
+
#
|
1032
|
+
# @example
|
1033
|
+
# Money.new(100, "USD").split(3) #=> [Money.new(34), Money.new(33), Money.new(33)]
|
1034
|
+
def split(num)
|
1035
|
+
raise ArgumentError, "need at least one party" if num < 1
|
1036
|
+
low = Money.new(cents / num)
|
1037
|
+
high = Money.new(low.cents + 1)
|
1038
|
+
|
1039
|
+
remainder = cents % num
|
1040
|
+
result = []
|
1041
|
+
|
1042
|
+
num.times do |index|
|
1043
|
+
result[index] = index < remainder ? high : low
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
return result
|
1047
|
+
end
|
1048
|
+
|
983
1049
|
private
|
984
1050
|
|
985
1051
|
# Cleans up formatting rules.
|
@@ -994,6 +1060,12 @@ class Money
|
|
994
1060
|
rules = rules.pop
|
995
1061
|
rules = { rules => true } if rules.is_a?(Symbol)
|
996
1062
|
end
|
1063
|
+
if not rules.include?(:decimal_mark) and rules.include?(:separator)
|
1064
|
+
rules[:decimal_mark] = rules[:separator]
|
1065
|
+
end
|
1066
|
+
if not rules.include?(:thousands_separator) and rules.include?(:delimiter)
|
1067
|
+
rules[:thousands_separator] = rules[:delimiter]
|
1068
|
+
end
|
997
1069
|
rules
|
998
1070
|
end
|
999
1071
|
|
@@ -1004,56 +1076,66 @@ class Money
|
|
1004
1076
|
# @return [Integer]
|
1005
1077
|
#
|
1006
1078
|
def self.extract_cents(input, currency = Money.default_currency)
|
1007
|
-
# remove anything that's not a number, potential
|
1008
|
-
num = input.gsub(/[^\d|\.|,|\'
|
1079
|
+
# remove anything that's not a number, potential thousands_separator, or minus sign
|
1080
|
+
num = input.gsub(/[^\d|\.|,|\'|\-]/, '').strip
|
1009
1081
|
|
1010
1082
|
# set a boolean flag for if the number is negative or not
|
1011
1083
|
negative = num.split(//).first == "-"
|
1012
1084
|
|
1013
1085
|
# if negative, remove the minus sign from the number
|
1014
|
-
|
1086
|
+
# if it's not negative, the hyphen makes the value invalid
|
1087
|
+
if negative
|
1088
|
+
num = num.gsub(/^-/, '')
|
1089
|
+
else
|
1090
|
+
raise ArgumentError, "Invalid currency amount (hyphen)" if num.include?('-')
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
#if the number ends with punctuation, just throw it out. If it means decimal,
|
1094
|
+
#it won't hurt anything. If it means a literal period or comma, this will
|
1095
|
+
#save it from being mis-interpreted as a decimal.
|
1096
|
+
num.chop! if num.match /[\.|,]$/
|
1015
1097
|
|
1016
|
-
# gather all
|
1017
|
-
|
1098
|
+
# gather all decimal_marks within the result number
|
1099
|
+
used_decimal_marks = num.scan /[^\d]/
|
1018
1100
|
|
1019
|
-
# determine the number of unique
|
1101
|
+
# determine the number of unique decimal_marks within the number
|
1020
1102
|
#
|
1021
1103
|
# e.g.
|
1022
1104
|
# $1,234,567.89 would return 2 (, and .)
|
1023
1105
|
# $125,00 would return 1
|
1024
1106
|
# $199 would return 0
|
1025
|
-
# $1 234,567.89 would raise an error (
|
1026
|
-
case
|
1027
|
-
# no
|
1107
|
+
# $1 234,567.89 would raise an error (decimal_marks are space, comma, and period)
|
1108
|
+
case used_decimal_marks.uniq.length
|
1109
|
+
# no decimal_mark or thousands_separator; major (dollars) is the number, and minor (cents) is 0
|
1028
1110
|
when 0 then major, minor = num, 0
|
1029
1111
|
|
1030
|
-
# two
|
1031
|
-
# major/minor
|
1112
|
+
# two decimal_marks, so we know the last item in this array is the
|
1113
|
+
# major/minor thousands_separator and the rest are decimal_marks
|
1032
1114
|
when 2
|
1033
|
-
|
1034
|
-
# remove all
|
1035
|
-
major, minor = num.gsub(
|
1115
|
+
decimal_mark, thousands_separator = used_decimal_marks.uniq
|
1116
|
+
# remove all decimal_marks, split on the thousands_separator
|
1117
|
+
major, minor = num.gsub(decimal_mark, '').split(thousands_separator)
|
1036
1118
|
min = 0 unless min
|
1037
1119
|
when 1
|
1038
|
-
# we can't determine if the comma or period is supposed to be a
|
1120
|
+
# we can't determine if the comma or period is supposed to be a decimal_mark or a thousands_separator
|
1039
1121
|
# e.g.
|
1040
|
-
# 1,00 - comma is a
|
1041
|
-
# 1.000 - period is a
|
1042
|
-
# 1,000 - comma is a
|
1043
|
-
# 1,000,000 - comma is a
|
1044
|
-
# 10000,00 - comma is a
|
1045
|
-
# 1000,000 - comma is a
|
1046
|
-
|
1047
|
-
# assign first
|
1048
|
-
|
1049
|
-
|
1050
|
-
#
|
1051
|
-
if num.scan(
|
1052
|
-
major, minor = num.gsub(
|
1122
|
+
# 1,00 - comma is a thousands_separator
|
1123
|
+
# 1.000 - period is a thousands_separator
|
1124
|
+
# 1,000 - comma is a decimal_mark
|
1125
|
+
# 1,000,000 - comma is a decimal_mark
|
1126
|
+
# 10000,00 - comma is a thousands_separator
|
1127
|
+
# 1000,000 - comma is a thousands_separator
|
1128
|
+
|
1129
|
+
# assign first decimal_mark for reusability
|
1130
|
+
decimal_mark = used_decimal_marks.first
|
1131
|
+
|
1132
|
+
# decimal_mark is used as a decimal_mark when there are multiple instances, always
|
1133
|
+
if num.scan(decimal_mark).length > 1 # multiple matches; treat as decimal_mark
|
1134
|
+
major, minor = num.gsub(decimal_mark, ''), 0
|
1053
1135
|
else
|
1054
1136
|
# ex: 1,000 - 1.0000 - 10001.000
|
1055
1137
|
# split number into possible major (dollars) and minor (cents) values
|
1056
|
-
possible_major, possible_minor = num.split(
|
1138
|
+
possible_major, possible_minor = num.split(decimal_mark)
|
1057
1139
|
possible_major ||= "0"
|
1058
1140
|
possible_minor ||= "00"
|
1059
1141
|
|
@@ -1062,14 +1144,14 @@ class Money
|
|
1062
1144
|
# 1,00 => 1.00
|
1063
1145
|
# 1.0000 => 1.00
|
1064
1146
|
# 1.2 => 1.20
|
1065
|
-
if possible_minor.length != 3 #
|
1147
|
+
if possible_minor.length != 3 # thousands_separator
|
1066
1148
|
major, minor = possible_major, possible_minor
|
1067
1149
|
else
|
1068
1150
|
# minor length is three
|
1069
|
-
# let's try to figure out intent of the
|
1151
|
+
# let's try to figure out intent of the thousands_separator
|
1070
1152
|
|
1071
1153
|
# the major length is greater than three, which means
|
1072
|
-
# the comma or period is used as a
|
1154
|
+
# the comma or period is used as a thousands_separator
|
1073
1155
|
# e.g.
|
1074
1156
|
# 1000,000
|
1075
1157
|
# 100000,000
|
@@ -1077,8 +1159,8 @@ class Money
|
|
1077
1159
|
major, minor = possible_major, possible_minor
|
1078
1160
|
else
|
1079
1161
|
# number is in format ###{sep}### or ##{sep}### or #{sep}###
|
1080
|
-
# handle as , is sep, . is
|
1081
|
-
if
|
1162
|
+
# handle as , is sep, . is thousands_separator
|
1163
|
+
if decimal_mark == '.'
|
1082
1164
|
major, minor = possible_major, possible_minor
|
1083
1165
|
else
|
1084
1166
|
major, minor = "#{possible_major}#{possible_minor}", 0
|
@@ -1091,7 +1173,7 @@ class Money
|
|
1091
1173
|
raise ArgumentError, "Invalid currency amount"
|
1092
1174
|
end
|
1093
1175
|
|
1094
|
-
# build the string based on major/minor since
|
1176
|
+
# build the string based on major/minor since decimal_mark/thousands_separator have been removed
|
1095
1177
|
# avoiding floating point arithmetic here to ensure accuracy
|
1096
1178
|
cents = (major.to_i * currency.subunit_to_unit)
|
1097
1179
|
# Because of an bug in JRuby, we can't just call #floor
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 3
|
8
7
|
- 5
|
9
|
-
-
|
10
|
-
version: 3.5.
|
8
|
+
- 5
|
9
|
+
version: 3.5.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tobias Luetke
|
@@ -19,7 +18,7 @@ autorequire:
|
|
19
18
|
bindir: bin
|
20
19
|
cert_chain: []
|
21
20
|
|
22
|
-
date:
|
21
|
+
date: 2011-01-18 00:00:00 -05:00
|
23
22
|
default_executable:
|
24
23
|
dependencies:
|
25
24
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +29,6 @@ dependencies:
|
|
30
29
|
requirements:
|
31
30
|
- - ~>
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
hash: 3
|
34
32
|
segments:
|
35
33
|
- 0
|
36
34
|
- 4
|
@@ -45,7 +43,6 @@ dependencies:
|
|
45
43
|
requirements:
|
46
44
|
- - ">="
|
47
45
|
- !ruby/object:Gem::Version
|
48
|
-
hash: 15
|
49
46
|
segments:
|
50
47
|
- 2
|
51
48
|
- 0
|
@@ -61,7 +58,6 @@ dependencies:
|
|
61
58
|
requirements:
|
62
59
|
- - ">="
|
63
60
|
- !ruby/object:Gem::Version
|
64
|
-
hash: 3
|
65
61
|
segments:
|
66
62
|
- 0
|
67
63
|
version: "0"
|
@@ -75,7 +71,6 @@ dependencies:
|
|
75
71
|
requirements:
|
76
72
|
- - ">="
|
77
73
|
- !ruby/object:Gem::Version
|
78
|
-
hash: 3
|
79
74
|
segments:
|
80
75
|
- 0
|
81
76
|
version: "0"
|
@@ -115,7 +110,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
110
|
requirements:
|
116
111
|
- - ">="
|
117
112
|
- !ruby/object:Gem::Version
|
118
|
-
hash: 3
|
119
113
|
segments:
|
120
114
|
- 0
|
121
115
|
version: "0"
|
@@ -124,7 +118,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
118
|
requirements:
|
125
119
|
- - ">="
|
126
120
|
- !ruby/object:Gem::Version
|
127
|
-
hash: 23
|
128
121
|
segments:
|
129
122
|
- 1
|
130
123
|
- 3
|