List of usage examples for java.lang String valueOf
public static String valueOf(double d)
From source file:Main.java
public static String addZero(int number) { return number <= 9 ? "0" + number : String.valueOf(number); }
From source file:Main.java
public static String getFileNameFromUrl(String url) { String name = String.valueOf(System.currentTimeMillis()); try {//from w w w .j av a 2 s . c om name = url.substring(url.lastIndexOf('/') + 1); } catch (Exception e) { e.printStackTrace(); } return name; }
From source file:Main.java
static String getG(int hex) { return String.valueOf(Color.green(hex)); }
From source file:Main.java
static String getB(int hex) { return String.valueOf(Color.blue(hex)); }
From source file:Main.java
static String getR(int hex) { return String.valueOf(Color.red(hex)); }
From source file:Main.java
static String doubleD(int i) { if (i < 10) { return '0' + String.valueOf(i); } else {/*w w w . j a v a 2 s .c o m*/ return String.valueOf(i); } }
From source file:com.omertron.themoviedbapi.enumeration.ArtworkType.java
/** * Convert a string into an Enum type//ww w . j a v a2 s. c om * * @param artworkType * @return * @throws IllegalArgumentException If type is not recognised * */ public static ArtworkType fromString(String artworkType) { if (StringUtils.isNotBlank(artworkType)) { try { return ArtworkType.valueOf(artworkType.trim().toUpperCase()); } catch (IllegalArgumentException ex) { throw new IllegalArgumentException("ArtworkType " + artworkType + " does not exist.", ex); } } throw new IllegalArgumentException("ArtworkType must not be null"); }
From source file:Main.java
public static String getDayOfMonthString(int day) { switch (day % 10) { case 1:/*from w w w . ja va 2s. c o m*/ return String.valueOf(day) + "st"; case 2: return String.valueOf(day) + "nd"; case 3: return String.valueOf(day) + "rd"; default: return String.valueOf(day) + "th"; } }
From source file:Main.java
public static String formatMonthDate(int num) { if (num < 10) { return "0" + num; }//from ww w. j a v a 2 s .c o m return String.valueOf(num); }
From source file:Main.java
/** * @param uid//from w w w . j av a 2 s . c o m * @return */ public static String getUserUid(int uid) { String uidStr = String.valueOf(uid); StringBuffer sb = new StringBuffer(); for (int i = 0; i < 6 - uidStr.length(); i++) { sb.append("0"); } sb.append(uidStr); return sb.toString(); }