Deviopath › Go

Format a Price

Easy · Strings

fmt.Sprintf builds a string from a format. %.2f prints a float64 with two digits after the decimal point.

Write FormatPrice(amount) that returns the amount as a dollar string, for example 12.5 becomes "$12.50".

Next: Repeat a String