List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:com.examples.with.different.packagename.StringUtilsEqualsIndexOfTest.java
@Test public void testContainsIgnoreCase_LocaleIndependence() { final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() }; final String[][] tdata = { { "i", "I" }, { "I", "i" }, { "\u03C2", "\u03C3" }, { "\u03A3", "\u03C2" }, { "\u03A3", "\u03C3" }, }; final String[][] fdata = { { "\u00DF", "SS" }, }; for (final Locale testLocale : locales) { Locale.setDefault(testLocale); for (int j = 0; j < tdata.length; j++) { assertTrue(Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1], StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1])); }/*from w ww . jav a 2s . c o m*/ for (int j = 0; j < fdata.length; j++) { assertFalse(Locale.getDefault() + ": " + j + " " + fdata[j][0] + " " + fdata[j][1], StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1])); } } }
From source file:org.envirocar.app.network.RestClient.java
/** * start downloading the latest 5 tracks of the given user. * //from w w w . j av a 2 s .co m * @param user the user * @param token the users token * @param limit the maximum track count * @param page the page (/tracks/ is a paging-enabled resource) * @param handler called on success or failure */ public static void downloadTracks(String user, String token, int limit, int page, JsonHttpResponseHandler handler) { get(String.format(Locale.ENGLISH, "%s/users/%s/tracks?limit=%d&page=%d", ECApplication.BASE_URL, user, limit, page), handler, user, token); }
From source file:be.ceau.chart.enums.HoverMode.java
private HoverMode() { this.serialized = name().toLowerCase(Locale.ENGLISH); }
From source file:com.github.cherimojava.data.mongo.entity.EntityUtils.java
/** * decapitalizes a String. E.g. CamelCase will become camelCase while URL will stay URL, but URLe becomes uRLe. For * inversion see {@link #capitalize(String)}. * * @param name string to decapitalize}// w ww . j av a 2s .com * @return decapitalized string * @see #capitalize(String) */ public static String decapitalize(String name) { if (name.length() == 1) { return name.toLowerCase(Locale.ENGLISH); } if (!isAllUpperCase(name)) { return uncapitalize(name); } else { return name; } }
From source file:net.canadensys.dataportal.occurrence.config.OccurrencePortalConfigTest.java
@Test public void testGetDownloadEmailTemplateName() { assertEquals("download-email_en.ftl", occurrencePortalConfig.getDownloadEmailTemplateName(Locale.ENGLISH)); }
From source file:grails.web.CamelCaseUrlConverter.java
public String toUrlElement(String propertyOrClassName) { if (StringUtils.isBlank(propertyOrClassName)) { return propertyOrClassName; }//from w w w. ja v a 2 s .co m if (propertyOrClassName.length() > 1 && Character.isUpperCase(propertyOrClassName.charAt(0)) && Character.isUpperCase(propertyOrClassName.charAt(1))) { return propertyOrClassName; } return propertyOrClassName.substring(0, 1).toLowerCase(Locale.ENGLISH) + propertyOrClassName.substring(1); }
From source file:Main.java
/** Returns Charset impl, if one exists. This method * optionally uses ICU4J's CharsetICU.forNameICU, * if it is found on the classpath, else only uses * JDK's builtin Charset.forName. */ public static Charset forName(String name) { if (name == null) { throw new IllegalArgumentException(); }// ww w . j ava 2 s.c o m // Get rid of cruft around names, like <>, trailing commas, etc. Matcher m = CHARSET_NAME_PATTERN.matcher(name); if (!m.matches()) { throw new IllegalCharsetNameException(name); } name = m.group(1); String lower = name.toLowerCase(Locale.ENGLISH); Charset charset = COMMON_CHARSETS.get(lower); if (charset != null) { return charset; } else if ("none".equals(lower) || "no".equals(lower)) { throw new IllegalCharsetNameException(name); } else { Matcher iso = ISO_NAME_PATTERN.matcher(lower); Matcher cp = CP_NAME_PATTERN.matcher(lower); Matcher win = WIN_NAME_PATTERN.matcher(lower); if (iso.matches()) { // Handle "iso 8859-x" error name = "iso-8859-" + iso.group(1); charset = COMMON_CHARSETS.get(name); } else if (cp.matches()) { // Handle "cp-xxx" error name = "cp" + cp.group(1); charset = COMMON_CHARSETS.get(name); } else if (win.matches()) { // Handle "winxxx" and "win-xxx" errors name = "windows-" + win.group(1); charset = COMMON_CHARSETS.get(name); } if (charset != null) { return charset; } } if (getCharsetICU != null) { try { Charset cs = (Charset) getCharsetICU.invoke(null, name); if (cs != null) { return cs; } } catch (Exception e) { // ignore } } return Charset.forName(name); }
From source file:com.wealdtech.utils.EnvironmentType.java
@JsonCreator public static EnvironmentType fromString(final String type) { checkNotNull(type, "Environment type is required"); try {/*ww w . ja v a2 s.c o m*/ return valueOf(type.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException iae) { // N.B. we don't pass the iae as the cause of this exception because this happens during invocation, and in that case the // enum handler will report the root cause exception rather than the one we throw. throw new DataError.Bad("An environment type supplied is invalid"); } }
From source file:am.ik.categolj2.api.MediaTypeResolver.java
public MediaType resolveFromExtension(String extension) { Assert.notNull(extension, "extension must not be null"); MediaType mediaType = super.lookupMediaType(extension.toLowerCase(Locale.ENGLISH)); if (mediaType == null) { mediaType = fallbackMediaType;/*from w ww . j av a 2 s .c om*/ } return mediaType; }
From source file:org.opentravel.schemacompiler.repository.impl.NTLMSystemCredentialsProvider.java
public Credentials getCredentials(final AuthScope authscope) { Credentials credentials = super.getCredentials(authscope); if (AuthSchemes.NTLM.toUpperCase(Locale.ENGLISH).equals(authscope.getScheme())) { credentials = super.getCredentials(authscope); return traslateToNTLMCredentials(credentials); }//ww w . ja v a 2 s. com return credentials; }