Package cern.accsoft.steering.jmad.util
Class StringUtil
- java.lang.Object
-
- cern.accsoft.steering.jmad.util.StringUtil
-
public final class StringUtil extends java.lang.Object
some utils to handle strings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isWhitespacesOnly(java.lang.String string)
checks if the string consists only of whitespaces.static java.lang.String
join(java.util.Collection<?> objects, java.lang.String separator)
Joins the objects (using their toString method) using the given separator into one string.
-
-
-
Method Detail
-
isWhitespacesOnly
public static boolean isWhitespacesOnly(java.lang.String string)
checks if the string consists only of whitespaces. According to PMD this is a more efficient method than checking string.trim().length- Parameters:
string
- the string to test- Returns:
true
if the String consist only of white spaces, false otherwise
-
join
public static java.lang.String join(java.util.Collection<?> objects, java.lang.String separator)
Joins the objects (using their toString method) using the given separator into one string.- Parameters:
objects
- the objects that should be joined togetherseparator
- the separator to use between the object-string representations- Returns:
- a string, containing the string representations of all given objects, joined together by the use of the given separator.
-
-