Example usage for java.util Locale US

List of usage examples for java.util Locale US

Introduction

In this page you can find the example usage for java.util Locale US.

Prototype

Locale US

To view the source code for java.util Locale US.

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

/**
 * restore the bssid from esptouch result
 * /*from w  w w .j a  va 2  s  .  co  m*/
 * @param BSSID like 18fe34abcdef or 18FE34ABCDEF
 * @return like 18:fe:34:ab:cd:ef
 */
public static String restoreBSSID(String BSSID) {
    StringBuilder sb = new StringBuilder();
    for (int index = 0; index < BSSID.length(); index += 2) {
        sb.append(BSSID.substring(index, index + 2));
        if (index != BSSID.length() - 2) {
            sb.append(":");
        }
    }
    return sb.toString().toLowerCase(Locale.US);
}

From source file:Main.java

private static String createBundleURL(String host, String jsModulePath, boolean devMode, boolean hmr) {
    return String.format(Locale.US, BUNDLE_URL_FORMAT, host, jsModulePath, devMode, hmr);
}

From source file:Main.java

/**
 * Helper method to get the date and time from timestamp. Converts the Timestamp in Milliseconds to Date and Time and then
 * formats the Date object with {@link Format} and returns the String of Date and Time.
 *
 * @return//from  www.  j a  v  a2s.com
 */
public static String getDateAndTime(long timestamp) {
    Date date = new Date(timestamp);
    Format dateFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss", Locale.US);
    return dateFormat.format(date);
}

From source file:Main.java

public static File generateVideoPath() {
    try {/*from   w w w  .ja va  2 s .c o  m*/
        File storageDir = getAlbumDir();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
        return new File(storageDir, "VID_" + timeStamp + ".mp4");
    } catch (Exception e) {
        //            FileLog.e("tmessages", e);
    }
    return null;
}

From source file:Main.java

/**
 * Helper method to get the date and time from timestamp. Converts the Timestamp in Milliseconds to Date and Time and then
 * formats the Date object with {@link Format} and returns the String of Date and Time.
 *
 * @return/*from   ww w  . j  a v  a2s .co m*/
 */
public static String getFullDateAndTime(long timestamp) {
    Date date = new Date(timestamp);
    Format dateFormat = new SimpleDateFormat("EEEE, dd MMMM yyyy, hh:mm a", Locale.US);
    return dateFormat.format(date);
}

From source file:Main.java

public static File generatePicturePath() {
    try {//from  w  w  w.j  a  va  2s  .c o  m
        File storageDir = getAlbumDir();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
        return new File(storageDir, "IMG_" + timeStamp + ".jpg");
    } catch (Exception e) {
        //            FileLog.e("tmessages", e);
    }
    return null;
}

From source file:Main.java

public static String markerIconURL(String accessToken, String size, String symbol, String color) {
    // Make a string which follows the Mapbox Core API spec for stand-alone markers. This relies on the Mapbox API
    // for error checking.

    StringBuffer marker = new StringBuffer("pin-");
    final String lowerCaseSize = size.toLowerCase(Locale.US);

    if (lowerCaseSize.charAt(0) == 'l') {
        marker.append("l"); // large
    } else if (lowerCaseSize.charAt(0) == 's') {
        marker.append("s"); // small
    } else {/* w  w  w.ja  v a  2s  .c  om*/
        marker.append("m"); // default to medium
    }

    if (!TextUtils.isEmpty(symbol)) {
        marker.append(String.format("-%s+", symbol));
    } else {
        marker.append("+");
    }

    marker.append(color.replaceAll("#", ""));

    //        if (AppUtils.isRunningOn2xOrGreaterScreen(context)) {
    //            marker.append("@2x");
    //        }
    marker.append(".png");

    marker.append("?access_token=");
    marker.append(accessToken);
    return String.format(Locale.US, MAPBOX_BASE_URL_V4 + "marker/%s", marker);
}

From source file:Main.java

private static String createBundleURL(String host, String jsModulePath, boolean devMode, boolean jsMinify,
        boolean useDeltas) {
    return String.format(Locale.US, BUNDLE_URL_FORMAT, host, jsModulePath, useDeltas ? "delta" : "bundle",
            devMode, jsMinify);//from   www .  j  a v a  2  s  .c o  m
}

From source file:Main.java

public static String getShortFormattedDate(Date date) {

    String resp = "";
    try {//from  w  w  w .  ja v  a  2  s .  c  o m
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
        resp = sdf.format(date);
    } catch (Exception ex) {
    }
    return resp;
}

From source file:Main.java

/**
 * Get the mac address for mesh usage(For mesh require the BSSID uppercase and without colon). It is an inverse
 * method for getRawMacAddress/*from w  w w  .j a va 2s.c  o  m*/
 * 
 * @param bssid the bssid get from wifi scan
 * @return the mac address for mesh usage
 */
public static String getMacAddressForMesh(String bssid) {
    StringBuilder sb = new StringBuilder();
    char c;
    for (int i = 0; i < bssid.length(); i++) {
        c = bssid.charAt(i);
        if (c != ':') {
            sb.append(c);
        }
    }
    return sb.toString().toUpperCase(Locale.US);
}