toJSONPattern method

String toJSONPattern({
  1. SearchPatterns pattern = SearchPatterns.q,
})

Implementation

String toJSONPattern({SearchPatterns pattern = SearchPatterns.q}) {
  if (isNotEmpty) {
    String tmp = trim();
    while (tmp.contains("  ")) {
      tmp = tmp.replaceAll("  ", " ");
    }
    tmp = tmp.replaceAll(" ", "%20");
    tmp = "${pattern.name}=$tmp";
    return tmp;
  } else {
    return "";
  }
}