List of usage examples for java.util Locale US
Locale US
To view the source code for java.util Locale US.
Click Source Link
From source file:com.gettextresourcebundle.GettextResourceBundleControlTest.java
/** * test that the controls picks up PO files by locale * from the classpath//from w ww. jav a 2 s .c om */ @Test public void testClasspathReads() { ResourceBundle en_US = ResourceBundle.getBundle("locale", Locale.US, GettextResourceBundleControl.getControl("test")); assertEquals("The locale key should be en_US for the en_US locale", en_US.getString("locale"), "en_US"); ResourceBundle en_CA = ResourceBundle.getBundle("locale", Locale.CANADA, GettextResourceBundleControl.getControl("test")); assertEquals("The locale key should be en_CA for the en_CA locale", en_CA.getString("locale"), "en_CA"); }
From source file:mtmo.test.mediadrm.Utils.java
public static String accountIdToMarlinFormat(final String accountId) { ByteBuffer accountIdBuf = ByteBuffer.allocate(BYTES_OF_ACCOUNT_ID); try {// w w w . ja v a 2s . c om accountIdBuf.putLong(Long.valueOf(accountId)); } catch (Exception e) { return null; } accountIdBuf.order(ByteOrder.LITTLE_ENDIAN); return String.format(Locale.US, "%016x", accountIdBuf.getLong(0)); }
From source file:com.predic8.membrane.core.util.HttpUtil.java
public static DateFormat createGMTDateFormat() { SimpleDateFormat GMT_DATE_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); GMT_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); return GMT_DATE_FORMAT; }
From source file:Main.java
/** * Returns a ISO 8601 representation of the given date, which is * in an unknown timezone. This method is thread safe and non-blocking. * * @see <a href="https://issues.apache.org/jira/browse/TIKA-495">TIKA-495</a> * @param date given date// ww w . j a va 2 s. c om * @return ISO 8601 date string, without timezone details */ public static String formatDateUnknownTimezone(Date date) { // Create the Calendar object in the system timezone Calendar calendar = GregorianCalendar.getInstance(TimeZone.getDefault(), Locale.US); calendar.setTime(date); // Have it formatted String formatted = formatDate(calendar); // Strip the timezone details before returning return formatted.substring(0, formatted.length() - 1); }
From source file:Main.java
private static String millisToString(long millis, boolean text) { boolean negative = millis < 0; millis = java.lang.Math.abs(millis); millis /= 1000;/* ww w . ja v a 2 s. c o m*/ int sec = (int) (millis % 60); millis /= 60; int min = (int) (millis % 60); millis /= 60; int hours = (int) millis; String time; DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US); format.applyPattern("00"); if (text) { if (millis > 0) time = (negative ? "-" : "") + hours + "h" + format.format(min) + "min"; else if (min > 0) time = (negative ? "-" : "") + min + "min"; else time = (negative ? "-" : "") + sec + "s"; } else { if (millis > 0) time = (negative ? "-" : "") + hours + ":" + format.format(min) + ":" + format.format(sec); else time = (negative ? "-" : "") + min + ":" + format.format(sec); } return time; }
From source file:Main.java
/** * Gets the md5 hashed and upper-cased device id. * //from www .j a v a2 s. c om * @param context * the application context. * @return The encoded device id. */ public static String getEncodedDeviceId(Context context) { String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); String hashedId; if ((androidId == null) || isEmulator()) { hashedId = md5("emulator"); } else { hashedId = md5(androidId); } if (hashedId == null) { return null; } return hashedId.toUpperCase(Locale.US); }
From source file:com.sawyer.advadapters.app.data.MovieItem.java
private static String getStringToCompare(String text) { if (TextUtils.isEmpty(text)) return ""; String compare = text.toLowerCase(Locale.US); compare = compare.replace("the ", "").replace("a ", "").replace("an ", ""); return compare; }
From source file:com.cronutils.mapper.format.DateTimeFormatBuilder.java
DateTimeFormatBuilder() {
locale = Locale.US;
}
From source file:by.stub.utils.StringUtils.java
public static String toLower(final String toLower) { if (!isSet(toLower)) { return null; }/*from w ww. jav a 2s.c o m*/ return toLower.toLowerCase(Locale.US); }
From source file:at.alladin.rmbt.controlServer.LogResource.java
public static void checkLogDirectories() { if (!LOG_PATH.exists()) { LOG_PATH.mkdirs();// www .j a va2 s . c om } for (Platform platform : Platform.values()) { File logPath = new File(LOG_PATH, platform.toString().toLowerCase(Locale.US)); if (!logPath.exists()) { logPath.mkdirs(); } } System.out.println("Nettest log dir: " + LOG_PATH); }