string_converter 0.0.2
string_converter: ^0.0.2 copied to clipboard
This package enables you to easily convert string characters in many formats to their value.
example/lib/main.dart
import 'package:string_converter/converter.dart';
void main() {
StringConverter converter = StringConverter();
String text = "Hello";
// Convert utf8 to utf16
String utf16 = converter.toUTF16(text);
// \u0048\u0065\u006c\u006c\u006f
// Convert utf8 to utf32
String utf32 = converter.toUTF32(text);
// u+00000048u+00000065u+0000006cu+0000006cu+0000006f
// Convert utf16 to utf8
String utf8 = converter.toUTF8(utf16);
// Hello
// You can also call the extension method directly on the input
print(utf16.toUTF8());
// print Hello
// You can remove \u
print(utf8.toUTF16(remove: true));
// print 0048 0065 006c 006c 006f
// You can remove u+
print(utf8.toUTF32(remove: true));
// print 00000048 00000065 0000006c 0000006c 0000006f
}