ChestShop-3/com/Acrobot/Breeze/Utils/StringUtil.java

45 lines
1.1 KiB
Java
Raw Normal View History

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) {
2012-11-29 20:28:16 +01:00
char[] separators = new char[]{separator};
2012-11-23 21:01:53 +01:00
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);
}
}