content: extension StringExtensions on String {
    String substringAfter(String pattern) {
      final startIndex = indexOf(pattern);
      if (startIndex == -1) return substring(0);
  
      final start = startIndex + pattern.length;
      return substring(start);
    }
  
    String substringAfterLast(String pattern) {
      return split(pattern).last;
    }
  
    String substringEllipsis(int length) {
      if (this.length > length) {
        return ('${substring(0, length)}..');
      }
      return this;
    }
  
    double toDouble() {
      return double.parse(this);
    }
  
    int toInt() {
      return int.tryParse(this) ?? double.tryParse(this)?.toInt() ?? 0;
    }
  
    bool isEqualTo(String? other) {
      return this == other;
    }
  
    String substringBefore(String pattern) {
      final endIndex = indexOf(pattern);
      if (endIndex == -1) return substring(0);
  
      return substring(0, endIndex);
    }
  
    String substringBeforeLast(String pattern) {
      final endIndex = lastIndexOf(pattern);
      if (endIndex == -1) return substring(0);
  
      return substring(0, endIndex);
    }
  
    String substringBetween(String left, String right) {
      int startIndex = 0;
      int index = indexOf(left, startIndex);
      if (index == -1) return "";
      int leftIndex = index + left.length;
      int rightIndex = indexOf(right, leftIndex);
      if (rightIndex == -1) return "";
      startIndex = rightIndex + right.length;
      return substring(leftIndex, rightIndex);
    }
  
    String replaceForbiddenCharacters(String source) {
      return replaceAll(
          RegExp(
              r'[\\/:*?"<>|\0]|(^CON$|^PRN$|^AUX$|^NUL$|^COM[1-9]$|^LPT[1-9]$)'),
          source);
    }
  
    bool isMediaVideo() {
      return [
        "3gp",
        "avi",
        "mpg",
        "mpeg",
        "webm",
        "ogg",
        "flv",
        "m4v",
        "mvp",
        "mp4",
        "wmv",
        "mkv",
        "mov"
      ].any((extension) => toLowerCase().endsWith(extension));
    }
  }
  