string_converter 0.0.5
string_converter: ^0.0.5 copied to clipboard

This package enables you to easily convert string characters in many formats to their value.

string_converter #

String type converter for Dart

  • UTF8 <-> UTF16
  • UTF8 <-> UTF32
  • UTF8 <-> Binary
  • UTF8 <-> Octal

Example #

final converter = StringConverter();
String text = "Hello";

// Convert utf8 to utf16
String utf16 = converter.toUTF16(text);
// 0048 0065 006c 006c 006f

// Convert utf8 to binary
String binary = converter.toOctal(text);
// 110 145 154 154 157

// Convert utf16 to utf8
String utf8 = converter.toUTF8(utf16);
// Hello

You can use the extension method directly on the string too

print("hello".toUTF16());
// 0048 0065 006c 006c 006f

Usage #

You can remove space with args space

"hello".toUTF16(space: false);
// 00480065006c006c006f

You can make sure all bytes are there bits long with args format

"5".toBinary();                 // 110101
"5".toBinary(format: true);     // 00110101
0
likes
110
pub points
66%
popularity

This package enables you to easily convert string characters in many formats to their value.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on string_converter