Example usage for java.util Locale CANADA

List of usage examples for java.util Locale CANADA

Introduction

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

Prototype

Locale CANADA

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getPercentInstance(Locale.CANADA);
    System.out.println(numberFormat.getMaximumFractionDigits());
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getPercentInstance(Locale.CANADA);
    System.out.println(numberFormat.isGroupingUsed());
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.CANADA);
    System.out.println(numberFormat.getCurrency().getDisplayName());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Number number = NumberFormat.getPercentInstance(Locale.CANADA).parse("123.45%");
    // 1.2345/*from  ww w .  ja  v a 2  s . c o  m*/
    if (number instanceof Long) {
        System.out.println("Long value");
    } else {
        System.out.println("Double value");
    }
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BreakIterator iterator = BreakIterator.getWordInstance(Locale.CANADA);
    iterator.setText("a sentence");
    for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
        System.out.println(index);
    }//from   ww w.  jav a 2 s.  c  o m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BreakIterator iterator = BreakIterator.getLineInstance(Locale.CANADA);
    iterator.setText("line1\nline2");
    for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
        System.out.println(index);
    }// w w  w.j  a v  a  2  s.  c o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BreakIterator iterator = BreakIterator.getSentenceInstance(Locale.CANADA);
    iterator.setText("this is a test.");
    for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
        System.out.println(index);
    }/*from  w  w  w  .j a va2 s  .  co m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    BreakIterator iterator = BreakIterator.getCharacterInstance(Locale.CANADA);
    iterator.setText("aString");
    for (int index = iterator.first(); index != BreakIterator.DONE; index = iterator.next()) {
        System.out.println(index);
    }/*w  w  w. j av a2s .  c om*/
}

From source file:Main.java

public static void main(String[] args) {

    // create a calendar
    Locale locale1 = Locale.CANADA;
    TimeZone tz1 = TimeZone.getTimeZone("GMT");
    Calendar cal1 = Calendar.getInstance(tz1, locale1);

    // display time zone for both calendars
    String tzname1 = tz1.getDisplayName();
    String name1 = locale1.getDisplayName();
    System.out.println("GMT and Canada: " + tzname1 + " " + name1);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Date date = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.CANADA).parse("21:44:07");
}