Package org.daisy.dotify.common.text
Class StringTools
- java.lang.Object
-
- org.daisy.dotify.common.text.StringTools
-
public class StringTools extends Object
StringTools is a utility class for simple static operations related to strings.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stringfill(char c, int length)Fill a String with a single character.static Stringfill(String s, int length)Fill a String with copies of another String.static intlength(String str)Count the number of code points in a String.
-
-
-
Method Detail
-
length
public static int length(String str)
Count the number of code points in a String. This is equivalent to calling codePointCount on the entire String (beginIndex=0 and endIndex=string.length()).- Parameters:
str- the String to count length on- Returns:
- returns the number of code points in the entire String
-
fill
public static String fill(char c, int length)
Fill a String with a single character.- Parameters:
c- the character to fill withlength- the length of the resulting String- Returns:
- returns a String filled with character c
-
fill
public static String fill(String s, int length)
Fill a String with copies of another String.- Parameters:
s- the String to fill withlength- the length of the resulting String- Returns:
- returns a String filled with String s
- Throws:
IllegalArgumentException- if the string is empty
-
-