An open API service indexing awesome lists of open source software.

https://github.com/shaunthegeek/dart-trim-zero

remove .0 from the end of Dart number string, give you a pretty number or price
https://github.com/shaunthegeek/dart-trim-zero

Last synced: about 1 month ago
JSON representation

remove .0 from the end of Dart number string, give you a pretty number or price

Awesome Lists containing this project

README

        

[![Dart CI](https://github.com/sinkcup/dart-pretty-number/actions/workflows/dart.yml/badge.svg)](https://github.com/sinkcup/dart-trim-zero/actions/workflows/dart.yml)
[![pub package](https://img.shields.io/pub/v/trim_zero.svg)](https://pub.dev/packages/trim_zero)
[![package publisher](https://img.shields.io/pub/publisher/trim_zero.svg)](https://pub.dev/packages/trim_zero/publisher)

A Dart library that removes trailing zeros from the end of a number string and gives you a nicely formatted number string.

## Usage

```dart
print('0.010'.trimZero()); // 0.01

double price = 99.00;
print(price.toString().trimZero()); // 99
```

## Development Guide

- [Creating packages | Dart](https://dart.dev/guides/libraries/create-packages)
- [Extension methods | Dart](https://dart.dev/language/extension-methods)