public static String getDate(String format, long anyDate) { if (0 == anyDate) return "error"; int[] localDate = createDate(anyDate); format = Util.replace(format, "%H", Util.makeTwo(localDate[TIME_HOUR])); format = Util.replace(format, "%M", Util.makeTwo(localDate[TIME_MINUTE])); format = Util.replace(format, "%S", Util.makeTwo(localDate[TIME_SECOND])); format = Util.replace(format, "%Y", "" + localDate[TIME_YEAR]); format = Util.replace(format, "%y", Util.makeTwo(localDate[TIME_YEAR] % 100)); format = Util.replace(format, "%m", Util.makeTwo(localDate[TIME_MON])); format = Util.replace(format, "%d", Util.makeTwo(localDate[TIME_DAY])); return format; }
/** * Convert Key # -> _ * * @param key * @return converted key */ private String convertKey(String key) { String retValue = Util.replace(key, "#", "_"); return retValue; } // convertKey
public static String xmlUnescape(String text) { if (-1 == text.indexOf('&')) { return text; } return Util.replace(text, escapedChars, unescapedChars, "&&&&&"); }
public static String xmlEscape(String text) { text = StringUtils.notNull(text); return Util.replace(text, unescapedChars, escapedChars, "\"'><&"); }