trimAtsignsFromKey function

String trimAtsignsFromKey(
  1. String key
)

input => '@25antwilling:sharelocation-1637156978786327@26juststay' or 'sharelocation-1637156978786327' output => sharelocation-1637156978786327

Implementation

String trimAtsignsFromKey(String key) {
  key = NotifyAndPut().removeNamespaceFromString(key);

  key = key.replaceAll('cached:', '');

  if (key.contains(':')) {
    key = key.split(':')[1];
  }
  if (key.contains('@')) {
    key = key.split('@')[0];
  }
  return key;
}