Documentation
¶
Overview ¶
Package iso4217 is a convenience library containing ISO 4217 currency codes
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByCode ¶
ByCode resolves the given code to the 3 character string and the number of minor unit digits to display for the given currency.
Example ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
name, minor := iso4217.ByCode(0)
fmt.Printf("name: '%s', minor: %d\n", name, minor)
}
Output: name: '', minor: 0
Example (Cad) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
name, minor := iso4217.ByCode(124)
fmt.Printf("name: '%s', minor: %d\n", name, minor)
}
Output: name: 'CAD', minor: 2
Example (Unknown) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
name, minor := iso4217.ByCode(1234591)
fmt.Printf("name: '%s', minor: %d\n", name, minor)
}
Output: name: '', minor: 0
Example (Xxx) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
name, minor := iso4217.ByCode(999)
fmt.Printf("name: '%s', minor: %d\n", name, minor)
}
Output: name: 'XXX', minor: 0
func ByName ¶
ByName resolves the given name to the numeric code and the number of minor unit digits to display for the given currency.
Example ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
code, minor := iso4217.ByName("")
fmt.Printf("code: %d, minor: %d\n", code, minor)
}
Output: code: 0, minor: 0
Example (Cad) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
code, minor := iso4217.ByName("CAD")
fmt.Printf("code: %d, minor: %d\n", code, minor)
}
Output: code: 124, minor: 2
Example (Unknown) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
code, minor := iso4217.ByName("NOT_REAL")
fmt.Printf("code: %d, minor: %d\n", code, minor)
}
Output: code: 0, minor: 0
Example (Xxx) ¶
package main
import (
"fmt"
"github.com/rmg/iso4217"
)
func main() {
code, minor := iso4217.ByName("XXX")
fmt.Printf("code: %d, minor: %d\n", code, minor)
}
Output: code: 999, minor: 0
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.