How can I display the number 10525.25 as 10.525,25 using regexp with Dart?
I want to change my number format. If number like 10525.25 I want to make like this = 10.525,25 If number is 40000.25 it must be like 4.000,25 How can I make this in dart? I use Flutter and I will show this in my Text widget.
The intl
package is what you are looking for. It will format numbers in any locale for you. The format you use in your examples is the same as German, for example:
import 'package:intl/intl.dart';
void main () {
final fmt = NumberFormat("#,##0.00", "de_DE");
print(fmt.format(10525.25));
print(fmt.format(40000.25));
}
Output:
10.525,25
40.000,25
You may need to tweak the first parameter to NumberFormat
to suit your formatting requirement.