Add String helper
This commit is contained in:
parent
2bcd46b73c
commit
b9fb24efb5
@ -1,2 +1 @@
|
||||
rootProject.name = 'sample-module-gradle'
|
||||
|
||||
rootProject.name = 'sample-module-gradle'
|
20
src/main/java/com/cubetiqs/util/StringHelper.java
Normal file
20
src/main/java/com/cubetiqs/util/StringHelper.java
Normal 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, "");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user