String converts the area to human readable units
()
| 53 | |
| 54 | // String converts the area to human readable units |
| 55 | func (a Area) String() string { |
| 56 | switch { |
| 57 | case a > km2: |
| 58 | return fmt.Sprintf("%.3f km^2", a/km2) |
| 59 | case a < 1: |
| 60 | return fmt.Sprintf("%.3f cm^2", a*cm2) |
| 61 | } |
| 62 | return fmt.Sprintf("%.3f m^2", a) |
| 63 | } |
no outgoing calls
no test coverage detected