part of 'extensions.dart';

extension StringExtensions on String {
  replaceUmlauts() {
    return replaceAll("ü", "ue")
        .replaceAll("ö", "oe")
        .replaceAll("ä", "ae")
        .replaceAll("ß", "ss")
        .replaceAll("Ü(?=[a-zäöüß ])", "Ue")
        .replaceAll("Ö(?=[a-zäöüß ])", "Oe")
        .replaceAll("Ä(?=[a-zäöüß ])", "Ae")
        .replaceAll("Ü", "UE")
        .replaceAll("Ö", "OE")
        .replaceAll("Ä", "AE");
  }

  Color hexToColor() {
    final buffer = StringBuffer();
    if (length == 6 || length == 7) buffer.write('ff');
    buffer.write(replaceFirst('#', ''));
    return Color(int.parse(buffer.toString(), radix: 16));
  }
}
