stripColons static method
Strip colons for emoji name. So, ':heart:' will become 'heart'.
Implementation
static String? stripColons(String? name,
[void Function(String message)? onError]) {
if (name == null) {
return null;
}
Iterable<Match> matches = EmojiParser.REGEX_NAME.allMatches(name);
if (matches.isEmpty) {
if (onError != null) {
onError(EmojiMessage.errorMalformedEmojiName);
}
return name;
}
return name.replaceAll(EmojiConst.charColon, EmojiConst.charEmpty);
}