All Projects → Naddiseo → dart-sprintf

Naddiseo / dart-sprintf

Licence: BSD-2-Clause license
Dart implementation of sprintf

Programming Languages

dart
5743 projects
python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to dart-sprintf

Sprintf.js
sprintf.js is a complete open source JavaScript sprintf implementation
Stars: ✭ 1,977 (+2340.74%)
Mutual labels:  sprintf
Voca
The ultimate JavaScript string library
Stars: ✭ 3,387 (+4081.48%)
Mutual labels:  sprintf
lwprintf
Lightweight printf library optimized for embedded systems
Stars: ✭ 98 (+20.99%)
Mutual labels:  sprintf
intl-format
A wrapper library for PHP to format and internationalize values in messages like sprintf
Stars: ✭ 12 (-85.19%)
Mutual labels:  sprintf

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].