FLUTTER ECOSYSTEM

Naddiseo/dart-sprintf

Dart-Implementierung von sprintf

Projektcover von dart-sprintf
Stars
89
Forks
20
Letzter Push (UTC)
31.10.2022
Projektstatus
Aktiv
no GitHub avatar
GITHUB User

no ↗

n/aearth
SprachenDartPython

Technische Themen

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 2 Einträge
  • testEntwicklung^1.16.0-nullsafety.13
  • lintsEntwicklung^1.0.1

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Projekt-README ein-/ausklappen

dart-sprintf

Dart implementation of sprintf.

Build Status

ChangeLog

ChangeLog.md

Getting Started

Add the following to your pubspec.yaml:

dependencies:
  sprintf: "^7.0.0"

then run pub install.

Next, import dart-sprintf:

import 'package:sprintf/sprintf.dart';
Example
import 'package:sprintf/sprintf.dart';

void main() {
	print(sprintf("%04i", [-42]));
	print(sprintf("%s %s", ["Hello", "World"]));
	print(sprintf("%#04x", [10]));
}
-042
Hello World
0x0a

Limitations

  • Negative numbers are wrapped as 64bit ints when formatted as hex or octal.

Differences to C's printf

  • When using fixed point printing of numbers with large exponents, C introduces errors after 20 decimal places. Dart-printf will just print 0s.