List of usage examples for java.lang Object toString
public String toString()
From source file:Main.java
public static String posListToWktCoords(Object coords, Object dim) { String[] coordsString = coords.toString().split(" "); int dimension; if (dim == null) { dimension = 2;/*w w w. ja va 2 s. c o m*/ } else { try { dimension = Integer.parseInt(dim.toString()); } catch (NumberFormatException e) { dimension = 2; } } StringBuilder results = new StringBuilder(); for (int i = 0; i < coordsString.length; i++) { if (i > 0 && i % dimension == 0) { results.append(','); } else if (i > 0) { results.append(' '); } results.append(coordsString[i]); } return results.toString(); }
From source file:Main.java
/** * Hash a string//from w w w. j a va 2s. c o m * * @param toHash String to be hashed. * * @return Hashed string. */ public static String hash(Object toHash) { String hashString = toHash.toString(); MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { return hashString; } md.update(hashString.getBytes(), 0, hashString.length()); return convertToHex(md.digest()); }
From source file:Main.java
public static boolean obj2Bool(Object obj) { if (obj == null) return false; return str2Bool(obj.toString(), false); }
From source file:Main.java
public static String escape(Object object) { return (object == null) ? "" : escape(object.toString()); }
From source file:Main.java
public static int toInt(Object obj) { if (obj == null) return 0; return toInt(obj.toString(), 0); }
From source file:Main.java
public static boolean isNotNull(Object input) { if (input == null) return false; if ("".equalsIgnoreCase(input.toString().trim())) return false; return true;//from ww w . j ava2s . c om }
From source file:Main.java
public static String trim(Object obj) { if (obj == null) { return ""; }/*ww w .j a va2s .c o m*/ return trim(obj.toString()); }
From source file:Main.java
public static int toInt(Object obj) { if (obj == null) { return 0; }/* w ww . j a v a 2 s . co m*/ return toInt(obj.toString(), 0); }
From source file:Main.java
public static String toString(List<?> l) { if (l == null) { return "null"; }// ww w . j a v a2s .c o m StringBuilder sb = new StringBuilder("("); String sep = ""; for (Object object : l) { sb.append(sep).append(object.toString()); sep = separator; } return sb.append(")").toString(); }
From source file:Main.java
public static String toString(Set<?> s) { if (s == null) { return "null"; }//from ww w . ja va2s . co m StringBuilder sb = new StringBuilder("{"); String sep = ""; for (Object object : s) { sb.append(sep).append(object.toString()); sep = separator; } return sb.append("}").toString(); }