m3_lightmeter/lib/utils/to_string_signed.dart
2023-05-11 15:04:54 +02:00

19 lines
399 B
Dart

extension SignedString on num {
String toStringSigned() {
if (this > 0) {
return "+${toString()}";
} else {
return toString();
}
}
}
extension SignedStringDouble on double {
String toStringSignedAsFixed(int fractionDigits) {
if (this > 0) {
return "+${toStringAsFixed(fractionDigits)}";
} else {
return toStringAsFixed(fractionDigits);
}
}
}