Show sign or leave the space blank?

How can I show the sign of the Amount only if the amount is negative? Else just leave the space blank. I have a field type float64, which contains the Amount so is it possible if I can only show the sign if the Amount is Negative else leave the space blank.

For example, the Amount is -00008908.00 then show -00008908.00 else just show 00008908.00 and leave the place for the sign empty.

Something like this?

package main

import (

func main() {
	var test float64 = -1.0
	test = -0.1
	test = 1
	test = 0.1

func Float2String(xF float64) string {
	if math.Trunc(xF) == xF {
		return fmt.Sprintf("'% 09.0f'", xF)
	} else {
		return fmt.Sprintf("'% 09.2f'", xF)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.