substringByStr method

String substringByStr(
  1. String start,
  2. String end
)

截取2个字符串之间的字符串

Implementation

String substringByStr(String start, String end) {
  if (this.isEmptyString) {
    return '';
  }
  int startIndex = this?.indexOf(start) ?? 0;
  int endIndex = this?.indexOf(end, startIndex + start.length) ?? 0;
  return this?.substring(startIndex + start.length, endIndex) ?? "";
}