Moved un/capitlize to RenderUtils
This commit is contained in:
parent
c55c8d803d
commit
9ff60a6f6b
5 changed files with 57 additions and 31 deletions
|
@ -59,6 +59,11 @@ public final class RenderUtils {
|
|||
*/
|
||||
public static final DateTimeFormatter RFC_2822_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
|
||||
/**
|
||||
* Year formatter.
|
||||
*/
|
||||
static public final DateTimeFormatter YEAR_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy").withLocale(Localization.getLocale());
|
||||
private static final String DEFAULT_USER_AGENT =
|
||||
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
|
||||
|
||||
|
@ -101,6 +106,19 @@ public final class RenderUtils {
|
|||
return String.format("@%03d", beats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Capitalizes a String.
|
||||
*
|
||||
* @param src the source String
|
||||
* @return the capitalized String
|
||||
*/
|
||||
public static String capitalize(String src) {
|
||||
if (src == null || src.isBlank()) {
|
||||
return src;
|
||||
}
|
||||
return src.substring(0, 1).toUpperCase(Localization.getLocale()) + src.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a String to JavaScript/ECMAScript.
|
||||
*
|
||||
|
@ -402,6 +420,19 @@ public final class RenderUtils {
|
|||
return new String(buff, 0, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Un-capitalizes a String.
|
||||
*
|
||||
* @param src the source String
|
||||
* @return the capitalized String
|
||||
*/
|
||||
public static String uncapitalize(String src) {
|
||||
if (src == null || src.isBlank()) {
|
||||
return src;
|
||||
}
|
||||
return src.substring(0, 1).toLowerCase(Localization.getLocale()) + src.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the formatted server uptime.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue