Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Move everything to file root
Browse files Browse the repository at this point in the history
  • Loading branch information
sinnlosername committed Nov 24, 2017
1 parent a9b9157 commit 81e9cc4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
File renamed without changes.
20 changes: 8 additions & 12 deletions example.go
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
package main
package gocurrency

import (
"github.com/sinnlosername/gocurrency/sinnlosername/gocurrency/gocurrency"
)

func main() {
func _() {

/* Example using static methods */
{
//Money value to start with
money := 13.37

//Convert from euros to us dollars (USD)
money = gocurrency.ConvertEURTo("USD", money)
money = ConvertEURTo("USD", money)

//Convert from us dollars (USD) to singapore dollars (SGD)
money = gocurrency.ConvertFromTo("USD", "SGD", money)
money = ConvertFromTo("USD", "SGD", money)

//Convert from singapore dollars (SGD) to euros (EUR)
money = gocurrency.ConvertToEUR("SGD", money)
money = ConvertToEUR("SGD", money)

//Check if the money is valid (valid means not 0 and not infinite)
println(gocurrency.IsNumberValid(money))
println(IsNumberValid(money))

//Print the number formatted with 2 floating points
println(gocurrency.FormatNumber(money, 2))
println(FormatNumber(money, 2))
}

/* Example using Money type */
{
//Money object to start with, requires the money value and the currency of the money
tmon := gocurrency.Money{Value: 13.37, Currency: "EUR"}
tmon := Money{Value: 13.37, Currency: "EUR"}

//Convert from euros to us dollars (USD)
tmon.To("USD")
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 81e9cc4

Please sign in to comment.