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.
import 'package:string_converter/converter.dart';
void main() {
StringConverter converter = StringConverter();
String text = "Hello";
// Convert utf8 to utf16
String utf16 = converter.toUTF16(text);
print("UTF16: $utf16");
// 0048 0065 006c 006c 006f
// Convert utf8 to utf32
String utf32 = converter.toUTF32(text);
print("UTF32: $utf32");
// 00000048 00000065 0000006c 0000006c 0000006f
// Convert utf8 to binary
String binary = converter.toBinary(text);
print("Binary: $binary");
// 1001000 1100101 1101100 1101100 1101111
// Convert utf8 to octal
String octal = converter.toOctal(text);
print("Octal: $octal");
// 110 145 154 154 157
// You can also call the extension method directly on the input
print(utf32.toUTF8());
// print Hello
print(text.toBinary(format: true));
}