All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ankurpathak.util.Strings Maven / Gradle / Ivy

Go to download

Java library for username validation for general use and with bean validation api.

There is a newer version: 1.4.0
Show newest version
package com.github.ankurpathak.util;

import java.util.Objects;

public class Strings {

    public static final String BLANK = "";

    public static boolean isBlank(String string){
        return string == null || Objects.equals(string.trim(), BLANK);
    }


    public static Character firstChar(String string){
        if(!isBlank(string)){
            return string.charAt(0);
        }else {
            return null;
        }
    }

    public static Character lastChar(String string){
        if(!isBlank(string)){
            return string.charAt(string.length() - 1);
        }else {
            return null;
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy