Skip to content

Instantly share code, notes, and snippets.

@iebb
Created September 24, 2024 08:53
Show Gist options
  • Save iebb/70137801e61c7a58b8950bbbc6644f12 to your computer and use it in GitHub Desktop.
Save iebb/70137801e61c7a58b8950bbbc6644f12 to your computer and use it in GitHub Desktop.
Dart vs JS
import "package:intl/intl.dart";
void main() {
final formatterID = NumberFormat.currency(
locale: "id-ID", // Rp1.234.567,89 Indonesian
symbol: "Rp",
decimalDigits: 1,
name: "IDR",
);
final formatterNL = NumberFormat.currency(
locale: "nl-ID", // Rp 1.234.567,89 Dutch
symbol: "Rp",
decimalDigits: 1,
name: "IDR",
);
final formatterEN = NumberFormat.currency(
locale: "en-ID", // Rp1.234.567,89 English
symbol: "Rp",
decimalDigits: 1,
name: "IDR",
);
print("ID: " + formatterID.format(1234567.8901));
print("NL: " + formatterNL.format(1234567.8901));
print("EN: " + formatterEN.format(1234567.8901));
print("ID: " + formatterID.format(-1234567.8901));
print("NL: " + formatterNL.format(1234567.8901));
print("EN: " + formatterEN.format(-1234567.8901));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment