Skip to content

Instantly share code, notes, and snippets.

@buddypia
Created February 12, 2019 16:46
Show Gist options
  • Save buddypia/e7aaab0a219bc17edd2bc2d6326f2120 to your computer and use it in GitHub Desktop.
Save buddypia/e7aaab0a219bc17edd2bc2d6326f2120 to your computer and use it in GitHub Desktop.
class Utils {
static bool isNullOrEmpty(String s) {
return s == null || s == '';
}
static String stripTags(String s) {
return s.replaceAll(new RegExp('<[^>]*>'), '');
}
static Set<String> urlMatchs(String s) {
RegExp exp = new RegExp(
r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)");
return exp.allMatches(s).map((m) => m.group(0)).toSet();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment