Android examples for java.lang:String Compare
Compare string and handle null value
public class Main{ public static boolean emptyOrNull(String str) { return str == null || str.length() == 0; }/*w w w. ja va 2 s . c om*/ /** * * @param firstStr * @param secondStr * @return */ public static boolean stringCompare(String firstStr, String secondStr) { if (emptyOrNull(firstStr)) { return false; } if (firstStr.compareTo(secondStr) > 0) { return true; } else { return false; } } }