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.scvngr.levelup.core.model.factory.json.ErrorJsonFactoryTest.java
/** * Tests JSON parsing of a list with one item. * * @throws org.json.JSONException/*from ww w . ja v a2 s .c om*/ */ @SmallTest public void testJsonParse_listOfOne() throws JSONException { final String json = String.format(Locale.US, "[{ 'error': { 'code': '%s', 'message': '%s', 'object': '%s', 'property': '%s' }}]", ErrorFixture.CODE_VALUE, ErrorFixture.MESSAGE_VALUE, ErrorFixture.OBJECT_VALUE, ErrorFixture.PROPERTY_VALUE); final List<Error> errors = new ErrorJsonFactory().fromList(new JSONArray(json)); assertEquals(1, errors.size()); final Error error = errors.get(0); assertNotNull(error); assertEquals(ErrorFixture.CODE_VALUE, error.getCode()); assertEquals(ErrorFixture.MESSAGE_VALUE, error.getMessage()); assertEquals(ErrorFixture.OBJECT_VALUE, error.getObject()); assertEquals(ErrorFixture.PROPERTY_VALUE, error.getProperty()); }
From source file:com.frostwire.search.youtube.YouTubeSearchPerformer.java
@Override protected String getUrl(int page, String encodedKeywords) { return String.format(Locale.US, "https://gdata.youtube.com/feeds/api/videos?q=%s&orderby=relevance&start-index=1&max-results=%d&alt=json&prettyprint=true&v=2", encodedKeywords, MAX_RESULTS); }
From source file:com.littlehotspot.hadoop.mr.nginx.module.cdf.TestCDFScheduler.java
@Test public void date_2() { String pattern = "dd/MMM/yyyy:HH:mm:ss Z"; Date date = new Date(); System.out.println(DateFormatUtils.format(date, pattern, Locale.US)); }
From source file:cc.kave.commons.pointsto.evaluation.TimeEvaluation.java
public void exportResults(Path outputDir, ResultExporter exporter) throws IOException { Function<Double, String> format = number -> String.format(Locale.US, "%.3f", number); exporter.export(outputDir.resolve("TimeStatistics.txt"), analysisStatistics.entrySet().stream().map(entry -> { DescriptiveStatistics stats = entry.getValue(); return new String[] { entry.getKey(), format.apply(stats.getMin()), format.apply(stats.getStandardDeviation()), format.apply(stats.getMean()), format.apply(stats.getMax()) }; }));/* ww w . j a v a 2 s .co m*/ exporter.export(outputDir.resolve("StmtCountTimes.txt"), analysisTimes.stream() .map(entry -> new String[] { entry.analysisName, entry.contextType.getFullName(), Integer.toString(entry.numStmts), format.apply(entry.time) })); }
From source file:Main.java
public static boolean isWMVFile(String in) { return in.toLowerCase(Locale.US).endsWith(".wmv"); }
From source file:org.esupportail.dining.web.controllers.WebWidgetController.java
private String renderView(HttpServletRequest request, String viewName, Model model) throws Exception { View resolvedView = viewResolver.resolveViewName(viewName, Locale.US); MockHttpServletResponse mockResp = new MockHttpServletResponse(); resolvedView.render(model.asMap(), request, mockResp); return mockResp.getContentAsString(); }
From source file:org.hdiv.web.servlet.config.MvcNamespaceTests.java
@Before public void setUp() { appContext = new GenericWebApplicationContext(); appContext.setServletContext(new MockServletContext()); LocaleContextHolder.setLocale(Locale.US); }
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestMovieAdapter.java
@Override //Predefined isFilteredOut, optionally overridden here to change the built in logic protected boolean isFilteredOut(Long item, CharSequence constraint) { return !String.valueOf(item).toLowerCase(Locale.US).contains(constraint.toString().toLowerCase(Locale.US)); }
From source file:com.zavakid.mushroom.impl.MetricsConfig.java
static MetricsConfig create(String prefix) { return loadFirst(prefix, "mushroom-metric-" + prefix.toLowerCase(Locale.US) + ".properties", DEFAULT_FILE_NAME);//from w w w .j a va2 s.c o m }
From source file:io.github.karols.hocr4j.dom.HocrTag.java
/** * Creates a new tag with the given elements * and with name and attributes based on the given contents of the opening tag. * @param openingTagString contents of the opening tag * @param contents elements in the body of the tag *//*from w w w. j a va2s .co m*/ public HocrTag(String openingTagString, List<HocrElement> contents) { final String x = openingTagString; int i = 1; while (x.charAt(i) == ' ') i++; int nameStart = i; while (x.charAt(i) != ' ' && x.charAt(i) != '>' && x.charAt(i) != '/') { i++; } name = x.substring(nameStart, i).toLowerCase(Locale.US); while (x.charAt(i) == ' ') i++; HashMap<String, String> attributes = new HashMap<String, String>(); while (x.charAt(i) != '/' && x.charAt(i) != '>') { int attrNameStart = i; ing_bad: while (true) { switch (x.charAt(i)) { case '=': case '/': case ' ': case '>': break ing_bad; default: i++; } } String attrName = x.substring(attrNameStart, i); while (x.charAt(i) == ' ') i++; String attrValue = attrName; if (x.charAt(i) == '=') { i++; while (x.charAt(i) == ' ') i++; int attrValueStart = i; switch (x.charAt(i)) { case '\'': attrValueStart++; i++; while (x.charAt(i) != '\'') i++; attrValue = x.substring(attrValueStart, i); i++; break; case '\"': attrValueStart++; i++; while (x.charAt(i) != '\"') i++; attrValue = x.substring(attrValueStart, i); i++; break; default: while (x.charAt(i) != ' ' && x.charAt(i) != '/' && x.charAt(i) != '>') i++; attrValue = x.substring(attrValueStart, i); break; } } while (x.charAt(i) == ' ') i++; attributes.put(StringEscapeUtils.unescapeHtml4(attrName), StringEscapeUtils.unescapeHtml4(attrValue)); } this.id = attributes.get("id"); this.clazz = attributes.get("class"); this.title = attributes.get("title"); this.attributes = ImmutableMap.copyOf(attributes); this.elements = ImmutableList.copyOf(contents); }