0 purchases
sprintf
dart-sprintf #
Dart implementation of sprintf.
ChangeLog #
ChangeLog.md
Getting Started #
Add the following to your pubspec.yaml:
dependencies:
sprintf: "^7.0.0"
copied to clipboard
then run pub install.
Next, import dart-sprintf:
import 'package:sprintf/sprintf.dart';
copied to clipboard
Example #
import 'package:sprintf/sprintf.dart';
void main() {
print(sprintf("%04i", [-42]));
print(sprintf("%s %s", ["Hello", "World"]));
print(sprintf("%#04x", [10]));
}
copied to clipboard
-042
Hello World
0x0a
copied to clipboard
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.