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:thymeleafsandbox.springjsp.web.conversion.NumberFormatter.java
public String print(final Number object, final Locale locale) { final DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getNumberInstance(); final DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US); symbols.setGroupingSeparator('*'); numberFormat.setDecimalFormatSymbols(symbols); return numberFormat.format(object); }
From source file:com.spoiledmilk.ibikecph.search.HTTPAutocompleteHandler.java
public static JsonNode getOiorestGeocode(String urlString, String houseNumber) { JsonNode rootNode = performGET(urlString); JsonNode ret = null;//from w w w.j a v a2 s .c o m if (rootNode != null && rootNode.size() != 0) { ret = rootNode.get(0); for (int i = 0; i < rootNode.size(); i++) { if (rootNode.get(i).has("husnr") && rootNode.get(i).get("husnr").asText().toLowerCase(Locale.US).equals(houseNumber)) { ret = rootNode.get(i); break; } } } if (ret != null && ret.has("husnr")) { LOG.d("Geocode succesfull, searched number = " + houseNumber + " foundNumber = " + ret.get("husnr").asText()); } return ret; }
From source file:com.mercandalli.android.apps.files.user.ConversationUserModel.java
public ConversationUserModel(final JSONObject json) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.US); try {//from w w w . java 2 s. c o m if (json.has("id")) { this.id = json.getInt("id"); } if (json.has("id_conversation")) { this.id_conversation = json.getInt("id_conversation"); } if (json.has("id_user")) { this.id_user = json.getInt("id_user"); } if (json.has("num_messages")) { this.num_messages = json.getInt("num_messages"); } if (json.has("users")) { JSONArray users_json = json.getJSONArray("users"); for (int i = 0; i < users_json.length(); i++) { this.mUserModels.add(new UserModel(users_json.getJSONObject(i))); } } if (json.has("to_all")) { this.to_all = json.getBoolean("to_all"); } if (json.has("to_yourself")) { this.to_yourself = json.getBoolean("to_yourself"); } if (json.has("date_creation") && !json.isNull("date_creation")) { this.date_creation = dateFormat.parse(json.getString("date_creation")); } } catch (JSONException | ParseException e) { Log.e(getClass().getName(), "Failed to convert Json", e); } }
From source file:com.limegroup.gnutella.licenses.LicenseFactoryImpl.java
/** Determines if the given string can be a CC license. */ private static boolean isCCLicense(String s) { return s.toLowerCase(Locale.US).indexOf(CCConstants.URL_INDICATOR) != -1; }
From source file:com.littlehotspot.hadoop.mr.nginx.module.cdf.TestCDFScheduler.java
@Test public void date() { try {/* w ww .ja v a 2 s . c om*/ String dateString = "28/Mar/2017:11:13:23 +0800"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z", Locale.US); Date date = simpleDateFormat.parse(dateString); System.out.println(date); } catch (ParseException e) { e.printStackTrace(); } }
From source file:com.github.horrorho.inflatabledonkey.requests.MappedHeaders.java
public MappedHeaders(Collection<Header> headers) { this.headers = headers.stream() .collect(Collectors.toMap(header -> header.getName().toLowerCase(Locale.US), Function.identity())); }
From source file:me.henrytao.rxsharedpreferences.adapter.JSONObjectPreference.java
@SuppressLint("CommitPrefEdits") @Override//from w w w .ja v a 2s.c o m protected void putValue(String key, JSONObject value) { try { String jsonString = value.toString(); mSharedPreferences.edit().putString(key, jsonString).commit(); } catch (Exception ignore) { if (RxSharedPreferences.DEBUG) { Ln.d(String.format(Locale.US, "%s/%s", JSONObjectPreference.class.getSimpleName(), "putValue"), ignore); } } }
From source file:cc.kave.commons.pointsto.evaluation.runners.ProjectStoreRunner.java
private static void countFilteredUsages(Collection<ICoReTypeName> types, ProjectUsageStore store) throws IOException { PointsToUsageFilter filter = new PointsToUsageFilter(); int numTypes = 0; long numUsages = 0; for (ICoReTypeName type : types) { if (filter.test(type)) { ++numTypes;//from w w w . ja v a 2 s .c o m numUsages += store.getNumberOfUsagesPerProject(type).values().stream().mapToLong(i -> i.longValue()) .sum(); } store.flush(); } System.out.printf(Locale.US, "%s: %d types, %d usages\n", store.getName(), numTypes, numUsages); }
From source file:com.aestheticsw.jobkeywords.service.termextractor.impl.fivefilters.FiveFiltersClientTest.java
public void brokenJobTerms() throws FileNotFoundException { String content = FileUtils.getClassResourceAsString("../broken-content.html", this); try {/* ww w . j ava 2s.c om*/ TermFrequencyList terms = fiveFiltersClient.getTermFrequencyList(content, Locale.US); fail("Expected FiveFilters to throw exception"); } catch (RuntimeException expected) { assertNotNull(expected); assertTrue(expected.getMessage().contains("invalid content")); assertTrue(expected.getMessage().contains("index=")); } }
From source file:com.datastax.example.PreparedVsNonPreparedStatement.java
public void test1() { Random rnd = new Random(); final CsvReporter reporter = CsvReporter.forRegistry(metrics).formatFor(Locale.US) .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS) .build(new File("/Users/patrick/projects/")); logger.info("Beginning PreparedVsNonPreparedStatement:Test1"); reporter.start(1, TimeUnit.SECONDS); //Insert 10000 for (int i = 0; i < 1000000; i++) { String firstName = RandomStringUtils.randomAlphabetic(10); String lastName = RandomStringUtils.randomAlphabetic(10); String street = RandomStringUtils.randomAlphabetic(8); int post_code = rnd.nextInt(99999); int phone = rnd.nextInt(99999999); final Timer.Context context = test1.time(); session.execute("insert into users (id, firstname, lastname, street, post_code, phone) VALUES (" + i + ", '" + firstName + "', '" + lastName + "', '" + street + "', " + post_code + ", " + phone + ");"); context.stop();//ww w.j a va 2 s . co m } logger.info("Completed PreparedVsNonPreparedStatement:Test1"); }