org.vfdtech.implementations.VStringUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utilities-and-generic-tools Show documentation
Show all versions of utilities-and-generic-tools Show documentation
A utilities service with generic tools implementation. Can be
plugged into your java project
package org.vfdtech.implementations;
import org.apache.commons.lang3.StringUtils;
import org.vfdtech.interfaces.IStringUtils;
import java.util.Objects;
public class VStringUtils implements IStringUtils {
public static String ternaryCheck(Object value, String fallbackValue) {
return Objects.nonNull(value)
&& StringUtils.isNotBlank(value.toString()) ? (String) value : fallbackValue;
}
public static String ternaryCheck(String[] values, int index, String fallbackValue) {
return (values.length == 0 || values.length < index)
? "" : ternaryCheck(values[index], fallbackValue);
}
}