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:me.buom.shiro.util.SimpleHmacBuilder.java

public String buildStringToSign(HmacToken token) {
    httpRequest = WebUtils.toHttp(token.getRequest());
    String stringToSign = String.format(Locale.US, "%s\n%s\n%s\n%s\n%s", httpRequest.getMethod(),
            StringUtils.hasText(getHeader("Content-MD5")) ? DigestUtils.md5Hex(toByteArray(httpRequest)) : "",
            //getHeader("Content-MD5"),
            //getHeader("Content-Type"),
            httpRequest.getContentType(), getHeader("Date"), httpRequest.getRequestURI());

    return stringToSign;
}

From source file:com.inovaworks.ObservedProperty.java

public static ObservedProperty speed(double speedMps) {
    return new ObservedProperty("speed", String.format(Locale.US, "%.2f", speedMps * 3.6), "km/h");
}

From source file:at.uni_salzburg.cs.ckgroup.cscpp.engine.actions.Sonar.java

@Override
public String toString() {
    if (isComplete()) {
        return String.format(Locale.US, "Sonar (%d, '%s')", getTimestamp(), sonar);
    }/*from ww w  .j  av  a2  s  .co m*/
    return "Sonar";
}

From source file:com.gettextresourcebundle.GettextResourceBundleControlTest.java

/**
 * test that the controls picks up PO files by locale
 * from the filesystem/*from w  w  w  .j av a2 s. com*/
 */
@Test
public void testFileReads() {
    ResourceBundle en_US = ResourceBundle.getBundle("./src/test/resources/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("./src/test/resources/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:Main.java

/**
 * Returns a ISO 8601 representation of the given date. This method 
 * is thread safe and non-blocking.//ww w .  j  ava  2 s  . c  o  m
 *
 * @see <a href="https://issues.apache.org/jira/browse/TIKA-495">TIKA-495</a>
 * @param date given date
 * @return ISO 8601 date string, including timezone details
 */
public static String formatDate(Date date) {
    Calendar calendar = GregorianCalendar.getInstance(UTC, Locale.US);
    calendar.setTime(date);
    return doFormatDate(calendar);
}

From source file:at.uni_salzburg.cs.ckgroup.cscpp.engine.actions.Random.java

@Override
public String toString() {
    if (isComplete()) {
        return String.format(Locale.US, "Random (%d, %d)", getTimestamp(), random);
    }/*from  ww  w  .  j  a  v a 2  s  . c om*/
    return "Random";
}

From source file:name.gumartinm.weather.information.service.ServiceCurrentParser.java

public String createURIAPICurrent(final String urlAPI, final String APIVersion, final double latitude,
        final double longitude) {

    final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.US);
    final Object[] values = new Object[3];
    values[0] = APIVersion;/*from w ww.  j  a v a 2 s  .c o m*/
    values[1] = latitude;
    values[2] = longitude;

    return formatURIAPI.format(values);
}

From source file:org.jmesa.worksheet.WorksheetColumnTest.java

@Test
public void hasErrorByKey() {

    MockHttpServletRequest request = new MockHttpServletRequest();
    WebContext webContext = new HttpServletRequestWebContext(request);
    webContext.setLocale(Locale.US);

    Messages messages = new ResourceBundleMessages("org.jmesa.worksheet.testResourceBundle", webContext);

    Worksheet worksheet = new Worksheet("id");
    worksheet.setWebContext(webContext);
    worksheet.setMessages(messages);/*  w ww  .  j a v  a2s.  c om*/
    WorksheetRow row = new WorksheetRow(null);
    worksheet.addRow(row);

    WorksheetColumn column = new WorksheetColumn("name.firstName", null);
    row.addColumn(column);
    column.setErrorKey("column.nullvalue");

    assertTrue("The column does not have an error.", column.hasError());
}

From source file:at.uni_salzburg.cs.ckgroup.cscpp.engine.actions.Speed.java

@Override
public String toString() {
    if (isComplete()) {
        return String.format(Locale.US, "Speed (%d, %.1f)", getTimestamp(), speedOverGround);
    }//w w w . ja  v  a  2  s . com
    return "Speed";
}

From source file:com.huawei.streaming.cql.executor.mergeuserdefinds.RenameRule.java

/**
 * {@inheritDoc}// w  w w  .  j  a  v a 2s.  c  om
 */
@Override
public boolean match(File srcFile) {
    String fname = srcFile.getName().toUpperCase(Locale.US);
    for (String str : renameFiles) {
        if (fname.contains(str)) {
            return true;
        }
    }
    return false;
}