A null
safe Java string manipulation library.
For javadoc, visit this link
<dependency>
<groupId>com.github.giorgosart</groupId>
<artifactId>java-string-utils</artifactId>
<version>1.2.0</version>
</dependency>
import static com.github.giorgosart.StringUtils.defaultString;
import static com.github.giorgosart.StringUtils.truncate;
import static com.github.giorgosart.StringUtils.isBlank;
import static com.github.giorgosart.StringUtils.isEmpty;
import com.github.giorgosart.TruncateAt;
public class Main {
public static void main(String[] args) {
System.out.println(isEmpty("")); //true
System.out.println(isBlank("")); //true
System.out.println(defaultString("", "default string")); //"default string"
System.out.println(truncate("string", 2, TruncateAt.START.name())); //"st"
System.out.println(truncate("string", 2, TruncateAt.START.name(),true)); //"st..."
}
}