Package org.wso2.carbon.utils
Class StringUtils
- java.lang.Object
-
- org.wso2.carbon.utils.StringUtils
-
public class StringUtils extends Object
This class contains utility methods for Strings.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<String>getNonEmptyStringAfterTrim(String str)Returns non-emptyOptional<String>, if the givenStringis non-empty after applying trim() operation.static booleanisNullOrEmpty(String str)Check whether the givenStringis null or empty.static booleanisNullOrEmptyAfterTrim(String str)Check whether the givenStringis null of empty after the trim operation.
-
-
-
Method Detail
-
isNullOrEmpty
public static boolean isNullOrEmpty(String str)
Check whether the givenStringis null or empty.- Parameters:
str- input string- Returns:
- true if the given
Stringis null or empty.
-
isNullOrEmptyAfterTrim
public static boolean isNullOrEmptyAfterTrim(String str)
Check whether the givenStringis null of empty after the trim operation.- Parameters:
str- input string.- Returns:
- 'true' if the given
Stringis null or empty after trim.
-
getNonEmptyStringAfterTrim
public static Optional<String> getNonEmptyStringAfterTrim(String str)
Returns non-emptyOptional<String>, if the givenStringis non-empty after applying trim() operation.- Parameters:
str- inputString.- Returns:
Optional<String>, if the givenStringis non-empty after applying trim() operation. If not an emptyOptional<String>will be returned.
-
-