CakeWallet/lib/src/screens/wallet_connect/utils/string_parsing.dart
Omar Hatem c6b9f054cc
Switch to SSL for Cake's Electrum and Monero nodes (#1899)
* Force SSL for Electrum and Monero nodes
Some Cleanup

* minor [skip ci]

* potential fix for transactions not cleared correctly [skip ci]

* minor fix [skip ci]
2024-12-25 21:27:46 +02:00

21 lines
428 B
Dart

import 'dart:convert';
import 'dart:math';
import 'package:convert/convert.dart';
extension StringParsing on String {
String get utf8Message {
if (startsWith('0x')) {
final List<int> decoded = hex.decode(
substring(2),
);
return utf8.decode(decoded);
}
return this;
}
String safeSubString(int start, int end) {
return this.substring(0, min(this.toString().length, 12));
}
}