Example usage for java.util Locale ROOT

List of usage examples for java.util Locale ROOT

Introduction

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

Prototype

Locale ROOT

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

Click Source Link

Document

Useful constant for the root locale.

Usage

From source file:Main.java

public static void main(String[] args) {
    Locale locale = Locale.ROOT;

    System.out.println("Locale1:" + locale);

    // print the country of this locale
    System.out.println("Country:" + locale.getCountry());

}

From source file:RBCPTest.java

public static void main(String[] args) {
    ResourceBundle rb = ResourceBundle.getBundle("resources.XmlRB", Locale.ROOT);
    String type = rb.getString("type");
    System.out.println("Root locale. Key, type: " + type);
    System.out.println();/*from  ww  w .  j  ava  2 s .  c  om*/

    rb = ResourceBundle.getBundle("resources.XmlRB", Locale.JAPAN);
    type = rb.getString("type");
    System.out.println("Japan locale. Key, type: " + type);
    System.out.println();

    test(Locale.CHINA);
    test(new Locale("zh", "HK"));
    test(Locale.TAIWAN);
    test(Locale.CANADA);
}

From source file:Main.java

@SuppressLint("NewApi")
public static Locale getRootLocale() {
    if (android.os.Build.VERSION.SDK_INT < 9) {
        return Locale.ENGLISH;
    } else {/*from  ww w .j  a  v a  2s .  c om*/
        return Locale.ROOT;
    }
}

From source file:Main.java

public static boolean getBooleanQueryParameter(Uri uri, String key, boolean defaultValue) {
    String flag = uri.getQueryParameter(key);
    if (flag == null) {
        return defaultValue;
    }// ww w .  j  av a  2  s .  co  m
    flag = flag.toLowerCase(Locale.ROOT);
    return (!"false".equals(flag) && !"0".equals(flag));
}

From source file:Main.java

public static boolean getOptionalChildBooleanContent(Element element, String name) throws Exception {
    Element child = getOptionalChild(element, name);
    if (child != null) {
        String value = getElementContent(child).toLowerCase(Locale.ROOT);
        return value.equals("true") || value.equals("yes");
    }/*from   w w  w .ja  v a 2s  . c  o m*/

    return false;
}

From source file:org.frat.common.util.AppConfigUtil.java

public static String getConfig(String key) {
    return messageSource.getMessage(key, null, Locale.ROOT);
}

From source file:Main.java

private static String trimUrlWebdav(String url) {
    if (url.toLowerCase(Locale.ROOT).endsWith(WEBDAV_PATH_4_0_AND_LATER)) {
        return url.substring(0, url.length() - WEBDAV_PATH_4_0_AND_LATER.length());
    }// w ww.jav a  2  s . c  o m

    return url;
}

From source file:Main.java

/**
 * Get all device accounts having specified domain name.
 * @param context application context/*from  ww  w .ja v a  2  s.  c  o m*/
 * @param domain domain name used for filtering
 * @return List of account names that contain the specified domain name
 */
public static List<String> getDeviceAccountsWithDomain(final Context context, final String domain) {
    final ArrayList<String> retval = new ArrayList<>();
    final String atDomain = "@" + domain.toLowerCase(Locale.ROOT);
    for (final Account account : getAccounts(context)) {
        if (account.name.toLowerCase(Locale.ROOT).endsWith(atDomain)) {
            retval.add(account.name);
        }
    }
    return retval;
}

From source file:Main.java

/**
 * Get all device accounts having specified domain name.
 * @param context application context//from   w w w . j ava  2 s .  co  m
 * @param domain domain name used for filtering
 * @return List of account names that contain the specified domain name
 */
public static List<String> getDeviceAccountsWithDomain(final Context context, final String domain) {
    final ArrayList<String> retval = new ArrayList<String>();
    final String atDomain = "@" + domain.toLowerCase(Locale.ROOT);
    for (final Account account : getAccounts(context)) {
        if (account.name.toLowerCase(Locale.ROOT).endsWith(atDomain)) {
            retval.add(account.name);
        }
    }
    return retval;
}

From source file:Main.java

public static String normalizeUrl(String url, boolean sslWhenUnprefixed) {
    String normalizedUrl = url;//from w  w w. j ava2s . c o  m

    if (normalizedUrl != null && normalizedUrl.length() > 0) {
        normalizedUrl = normalizedUrl.trim();

        if (!normalizedUrl.toLowerCase(Locale.ROOT).startsWith(HTTP_PROTOCOL)
                && !normalizedUrl.toLowerCase(Locale.ROOT).startsWith(HTTPS_PROTOCOL)) {
            if (sslWhenUnprefixed) {
                normalizedUrl = HTTPS_PROTOCOL + normalizedUrl;
            } else {
                normalizedUrl = HTTP_PROTOCOL + normalizedUrl;
            }
        }

        normalizedUrl = normalizeUrlSuffix(normalizedUrl);
    }
    return normalizedUrl != null ? normalizedUrl : "";
}