List of usage examples for java.lang String isEmpty
public boolean isEmpty()
From source file:Main.java
private static boolean isInvalidOrigin(String origin) { if (origin.isEmpty() || origin.contains("%")) { return true; }//from w w w .j a va2s . c o m try { return new URI(origin).getScheme() == null; } catch (URISyntaxException e) { return true; } }
From source file:Main.java
public static String replaceSpaces(String url) { if (!url.isEmpty()) { url = url.trim();/*from w w w .ja v a 2 s .c o m*/ if (url.contains(" ")) { Matcher spaces = SPACE.matcher(url); url = spaces.replaceAll("%20"); } } return url; }
From source file:Main.java
public static boolean isInteger(String s, int radix) { if (s.isEmpty()) return false; for (int i = 0; i < s.length(); i++) { if (i == 0 && s.charAt(i) == '-') { if (s.length() == 1) return false; else//from w w w . jav a 2 s . c o m continue; } if (Character.digit(s.charAt(i), radix) < 0) return false; } return true; }
From source file:Main.java
public static Boolean checkEmptyField(String... stringList) { for (String uniqueString : stringList) { if (uniqueString.isEmpty()) { return false; }/*from w w w .ja va 2s. c om*/ } return true; }
From source file:Main.java
public static String getFullyQualifiedName(String packageName, String className) { if (packageName.isEmpty()) return className; return packageName + "." + className; }
From source file:Main.java
public static HashMap<String, String> getApiPost(String[] keys, String[] values) { HashMap<String, String> box = new HashMap<>(); int i = 0;//www . j a va 2 s.c om for (String value : values) { if (!value.isEmpty()) box.put(keys[i], value); i++; } return box; }
From source file:Main.java
public static int getIntFromString(String s) { String tmp = s.replaceAll("[^\\d]", ""); if (!tmp.isEmpty()) { return Integer.parseInt(tmp); } else {//from ww w . j a va2 s. com return 0; } }
From source file:Main.java
public static final boolean isNullOrEmpty(String stg) { return (stg == null || stg.isEmpty() || "".equals(stg.trim().replaceAll("\\s", ""))); }
From source file:Main.java
public static void handle(View v, @Nullable String s) { v.setVisibility(s == null || s.isEmpty() ? View.GONE : View.VISIBLE); }
From source file:Main.java
public static Bitmap base64ToBitmap(String base64) { if (base64 != null && !base64.isEmpty()) { byte[] decodedString = Base64.decode(base64, Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); return decodedByte; }/* w w w.j a va 2s. c o m*/ return null; }