mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-23 16:57:41 +01:00
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package com.Acrobot.Breeze.Utils;
|
|
|
|
import com.google.common.base.Joiner;
|
|
import org.apache.commons.lang.WordUtils;
|
|
|
|
/**
|
|
* @author Acrobot
|
|
*/
|
|
public class StringUtil {
|
|
|
|
/**
|
|
* Capitalizes every first letter of a word
|
|
*
|
|
* @param string String to reformat
|
|
* @param separator Word separator
|
|
* @return Reformatted string
|
|
*/
|
|
public static String capitalizeFirstLetter(String string, char separator) {
|
|
char[] separators = new char[]{separator};
|
|
|
|
return WordUtils.capitalizeFully(string, separators).replace(String.valueOf(separator), " ");
|
|
}
|
|
|
|
/**
|
|
* Capitalizes every first letter of a word
|
|
*
|
|
* @param string String to reformat
|
|
* @return Reformatted string
|
|
* @see com.Acrobot.Breeze.Utils.StringUtil#capitalizeFirstLetter(String, char)
|
|
*/
|
|
public static String capitalizeFirstLetter(String string) {
|
|
return capitalizeFirstLetter(string, ' ');
|
|
}
|
|
|
|
/**
|
|
* Joins a String array
|
|
*
|
|
* @param array array to join
|
|
* @return Joined array
|
|
*/
|
|
public static String joinArray(String[] array) {
|
|
return Joiner.on(' ').join(array);
|
|
}
|
|
}
|