string_converter 0.0.1 copy "string_converter: ^0.0.1" to clipboard
string_converter: ^0.0.1 copied to clipboard

discontinued
outdated

String type converter for Dart

string_converter #

String type converter for Dart

  • UTF8 <-> UTF16
  • UTF16 <-> UTF8

Getting Started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  string_converter:

Next we need to install this

# Dart
pub get

# Flutter
flutter packages get

In your library add the following import:

import 'package:string_converter/converter.dart';

Usage #

void main() {
  final converter = StringConverter();

  // Convert utf8 to utf16
  String utf16 = converter.toUTF16("Hello");
  // 0048 0065 006c 006c 006fl

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

You can use the extension method directly on the string too

print(utf16.toUTF8());
// print Hello

You can remove \u using the args remove

print(utf8.toUTF16());
// \u0048\u0065\u006c\u006c\u006f

print(utf8.toUTF16(remove: true));
// print 0048 0065 006c 006c 006f
0
likes
0
pub points
33%
popularity

Publisher

unverified uploader

String type converter for Dart

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on string_converter