Add String helper

This commit is contained in:
Sambo Chea 2020-06-09 11:56:55 +07:00
parent 2bcd46b73c
commit b9fb24efb5
2 changed files with 21 additions and 2 deletions

View File

@ -1,2 +1 @@
rootProject.name = 'sample-module-gradle'
rootProject.name = 'sample-module-gradle'

View File

@ -0,0 +1,20 @@
package com.cubetiqs.util;
/**
* String util helper
*
* @author sombochea
* @since 1.0
*/
public final class StringHelper {
public static String getOrDefault(String text, String fallback) {
if (text == null || text.isEmpty()) {
return fallback;
}
return text;
}
public static String getOrEmpty(String text) {
return getOrDefault(text, "");
}
}