Search packages, repositories and app categories

GitHub repositoryNaddiseo/dart-sprintf

dart-sprintf

Dart implementation of sprintf

dart-sprintf project cover
Stars
89
Forks
20
Last push (UTC)
Oct 31, 2022
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

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.
no GitHub avatar
GitHub author

no ↗

n/aearth
LanguagesDartPython

Categories

Packages published by this repository

Dependencies used

Dependency list 2 items

  • testDevelopment^1.16.0-nullsafety.13
  • lintsDevelopment^1.0.1

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗