Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
openrs2/util/src/main/java/dev/openrs2/util/StringUtils.java

29 lines
621 B

package dev.openrs2.util;
import com.google.common.base.Preconditions;
public final class StringUtils {
public static String indefiniteArticle(String str) {
Preconditions.checkArgument(!str.isEmpty());
var first = Character.toLowerCase(str.charAt(0));
if (first == 'a' || first == 'e' || first == 'i' || first == 'o' || first == 'u') {
return "an";
} else {
return "a";
}
}
public static String capitalize(String str) {
if (str.isEmpty()) {
return str;
}
var first = Character.toUpperCase(str.charAt(0));
return first + str.substring(1);
}
private StringUtils() {
/* empty */
}
}