ensureColons static method

String ensureColons(
  1. String name
)

Wrap colons on both sides of emoji name. So, 'heart' will become ':heart:'.

Implementation

static String ensureColons(String name) {
  String res = name;
  if (!name.startsWith(EmojiConst.charColon, 0)) {
    res = EmojiConst.charColon + name;
  }

  if (!name.endsWith(EmojiConst.charColon)) {
    res += EmojiConst.charColon;
  }

  return res;
}