String str = null; boolean isEmptyOrNull = StringUtil.isEmpty(str);
String str = "true"; boolean boolVal = StringUtil.valueOf(str);In this example, the StringUtil.valueOf() method is used to convert the 'str' string to a boolean value. The boolean value 'boolVal' will be true because the 'str' string contains the value "true". Overall, StringUtil provides many useful methods for working with strings in Java, and it is part of the Liferay Portal kernel library.