Skip to content

giorgosart/java-string-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central Javadocs License: MIT

java-string-utils

A null safe Java string manipulation library.

For javadoc, visit this link

Usage

<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..."
    }
}