Package jasima.core.util
Class StringUtil
- java.lang.Object
-
- jasima.core.util.StringUtil
-
public class StringUtil extends Object
Static helper methods dealing with Strings and CharSequences.- Author:
- Torsten.Hildebrandt
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(String s1, String s2)Returns true if both strings are either null or s1.equal(s2).static booleanisNullOrEmpty(CharSequence cs)Return true is the given parameter (usually a String) is either null or empty.static Stringrepeat(CharSequence toRepeat, int n)Repeats a given String/CharSequencea certain number of times.static StringreplaceLineBreaks(String s)Replace all line breaks in the given String by " \n " to make it print in a single line.
-
-
-
Method Detail
-
repeat
public static String repeat(CharSequence toRepeat, int n)
Repeats a given String/CharSequencea certain number of times.- Parameters:
toRepeat- The CharSequence (usually a String) to repeat. Mustn't be null.n- How many times to repeat it. If n is 0 or negative, an empty String will be returned.- Returns:
- A String containing
ncopies oftoRepeat.
-
isNullOrEmpty
public static boolean isNullOrEmpty(CharSequence cs)
Return true is the given parameter (usually a String) is either null or empty.- Parameters:
cs- The CharSequence to check.- Returns:
- true, is the parameter was null or had a length of 0; false otherwise.
-
replaceLineBreaks
public static String replaceLineBreaks(String s)
Replace all line breaks in the given String by " \n " to make it print in a single line.
-
-