code: public static String stripSuffixIfPresent(final String key, final String suffix) {
      if (key.endsWith(suffix)) {
        return key.substring(0, key.length() - suffix.length());
      }
      return key;
    }
docs: Strips the suffix if it exists. This method will leave keys without a suffix unaltered.
  
  @param key the key to strip the suffix from
  @param suffix suffix to remove
  @return the key with the suffix removed, or the key unaltered if the suffix is not present