func price(unit string, amount string) string {
	if len(amount) == 0 {
		return amount
	}
	if amount[0] == '-' {
		amount = amount[1:]
	} else {
		amount = "-" + amount
	}
	for strings.Contains(amount, ".") && strings.HasSuffix(amount, "0") {
		amount = amount[:len(amount)-1]
	}
	if strings.HasSuffix(amount, ".") {
		amount = amount[:len(amount)-1]
	}
	unit = strings.ToUpper(unit)
	if sym, ok := symbols[unit]; ok {
		return sym + amount
	} else {
		if unit == "" {
			return amount
		}
		return unit + " " + amount
	}
}
func price(unit string, amount string) string {
	if len(amount) == 0 {
		return amount
	}
	if amount[0] == '-' {
		amount = amount[1:]
	} else {
		amount = "-" + amount
	}
	for strings.Contains(amount, ".") && strings.HasSuffix(amount, "0") {
		amount = amount[:len(amount)-1]
	}
	if strings.HasSuffix(amount, ".") {
		amount = amount[:len(amount)-1]
	}
	unit = strings.ToUpper(unit)
	if sym, ok := symbols[unit]; ok {
		return sym + amount
	} else {
		if unit == "" {
			return amount
		}
		return unit + " " + amount
	}
}
func price ( unit string , amount string ) string { if len ( amount ) == 0 { return amount } if amount [ 0 ] == '-' { amount = amount [ 1 : ] } else { amount = " " + amount } for strings . Contains ( amount , " " ) && strings . HasSuffix ( amount , " " ) { amount = amount [ : len ( amount ) - 1 ] } if strings . HasSuffix ( amount , " " ) { amount = amount [ : len ( amount ) - 1 ] } unit = strings . ToUpper ( unit ) if sym , ok := symbols [ unit ] ; ok { return sym + amount } else { if unit == " " { return amount } return unit + " " + amount } }
// Price flips the sign of the amount and prints it with a currency symbol for
// the given unit.
Price flips the sign of the amount and prints it with a currency symbol for the given unit .