PluralFormat Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| PluralFormat() |
Creates a new cardinal-number |
| PluralFormat(ULocale, PluralRules+PluralType, String) |
Creates a new PluralFormat for a plural type, a pattern and a locale. |
| PluralFormat(IntPtr, JniHandleOwnership) | |
| PluralFormat(Locale, PluralRules+PluralType) |
Creates a new PluralFormat for the plural type. |
| PluralFormat(Locale, PluralRules) |
Creates a new cardinal-number |
| PluralFormat(ULocale, String) |
Creates a new cardinal-number |
| PluralFormat(ULocale, PluralRules+PluralType) |
Creates a new PluralFormat for the plural type. |
| PluralFormat(ULocale, PluralRules, String) |
Creates a new cardinal-number |
| PluralFormat(PluralRules, String) |
Creates a new cardinal-number |
| PluralFormat(String) |
Creates a new cardinal-number |
| PluralFormat(Locale) |
Creates a new cardinal-number |
| PluralFormat(ULocale) |
Creates a new cardinal-number |
| PluralFormat(PluralRules) |
Creates a new cardinal-number |
| PluralFormat(ULocale, PluralRules) |
Creates a new cardinal-number |
PluralFormat()
Creates a new cardinal-number PluralFormat for the default FORMAT locale.
[Android.Runtime.Register(".ctor", "()V", "", ApiSince=24)]
public PluralFormat();
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for the default FORMAT locale. This locale will be used to get the set of plural rules and for standard number formatting.
Java documentation for android.icu.text.PluralFormat.PluralFormat().
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale, PluralRules+PluralType, String)
Creates a new PluralFormat for a plural type, a pattern and a locale.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules$PluralType;Ljava/lang/String;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale, Android.Icu.Text.PluralRules.PluralType? type, string? pattern);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules$PluralType;Ljava/lang/String;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale * Android.Icu.Text.PluralRules.PluralType * string -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the PluralFormat will be configured with rules for this locale. This locale will also be used for standard number formatting.
The plural type (e.g., cardinal or ordinal).
- pattern
- String
the pattern for this PluralFormat.
- Attributes
Remarks
Creates a new PluralFormat for a plural type, a pattern and a locale.
Android reference for android.icu.text.PluralFormat.PluralFormat.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(IntPtr, JniHandleOwnership)
protected PluralFormat(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Icu.Text.PluralFormat : nativeint * Android.Runtime.JniHandleOwnership -> Android.Icu.Text.PluralFormat
Parameters
- javaReference
-
IntPtr
nativeint
- transfer
- JniHandleOwnership
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(Locale, PluralRules+PluralType)
Creates a new PluralFormat for the plural type.
[Android.Runtime.Register(".ctor", "(Ljava/util/Locale;Landroid/icu/text/PluralRules$PluralType;)V", "", ApiSince=24)]
public PluralFormat(Java.Util.Locale? locale, Android.Icu.Text.PluralRules.PluralType? type);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Locale;Landroid/icu/text/PluralRules$PluralType;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Java.Util.Locale * Android.Icu.Text.PluralRules.PluralType -> Android.Icu.Text.PluralFormat
Parameters
- locale
- Locale
the default number formatting will be done using this locale.
The plural type (e.g., cardinal or ordinal).
- Attributes
Remarks
Creates a new PluralFormat for the plural type. The standard number formatting will be done using the given Locale.
Android reference for android.icu.text.PluralFormat.PluralFormat.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(Locale, PluralRules)
Creates a new cardinal-number PluralFormat for a given set of rules.
[Android.Runtime.Register(".ctor", "(Ljava/util/Locale;Landroid/icu/text/PluralRules;)V", "", ApiSince=24)]
public PluralFormat(Java.Util.Locale? locale, Android.Icu.Text.PluralRules? rules);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Locale;Landroid/icu/text/PluralRules;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Java.Util.Locale * Android.Icu.Text.PluralRules -> Android.Icu.Text.PluralFormat
Parameters
- locale
- Locale
the default number formatting will be done using this locale.
- rules
- PluralRules
defines the behavior of the PluralFormat
object.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given set of rules. The standard number formatting will be done using the given locale.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale, String)
Creates a new cardinal-number PluralFormat for a given pattern string and
locale.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Ljava/lang/String;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale, string? pattern);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Ljava/lang/String;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale * string -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the PluralFormat will be configured with
rules for this locale. This locale will also be used for standard
number formatting.
- pattern
- String
the pattern for this PluralFormat.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given pattern string and locale. The locale will be used to get the set of plural rules and for standard number formatting.
Example code:
import java.text.FieldPosition;
import android.icu.text.MessageFormat;
import android.icu.text.PluralFormat;
import android.icu.util.ULocale;
...
ULocale locEn = new ULocale("en");
ULocale locSl = new ULocale("sl");
String patEn = "one{dog} other{dogs}"; // English 'dog'
String patSl = "one{pes} two{psa} few{psi} other{psov}"; // Slovenian translation of dog in Plural Form
// Create a new PluralFormat for a given locale locale and pattern string
PluralFormat plfmtEn = new PluralFormat(locEn, patEn);
PluralFormat plfmtSl = new PluralFormat(locSl, patSl);
// Constructs a MessageFormat for the specified locale and pattern.
MessageFormat msgfmtEn = new MessageFormat("{0,number} {1}", locEn);
MessageFormat msgfmtSl = new MessageFormat("{0,number} {1}", locSl);
final int[] numbers = {0, 1, 2, 3, 4, 5, 10, 100, 101, 102};
System.out.println("Output by using PluralFormat and MessageFormat API\n");
System.out.printf("%-16s%-16s%-16s\n", "Number", "English", "Slovenian");
// Use MessageFormat.format () to format the objects and appends to the given StringBuffer
for (int num : numbers) {
StringBuffer msgEn = new StringBuffer();
StringBuffer msgSl = new StringBuffer();
msgfmtEn.format(new Object[] {num, plfmtEn.format(num)}, msgEn, new FieldPosition(0));
msgfmtSl.format(new Object[] {num, plfmtSl.format(num)}, msgSl, new FieldPosition(0));
System.out.printf("%-16s%-16s%-16s\n", num, msgEn, msgSl);
}
System.out.println();
// Equivalent code with message format pattern
String msgPatEn = "{0,plural, one{# dog} other{# dogs}}";
String msgPatSl = "{0,plural, one{# pes} two{# psa} few{# psi} other{# psov}}";
MessageFormat altMsgfmtEn = new MessageFormat(msgPatEn, locEn);
MessageFormat altMsgfmtSl = new MessageFormat(msgPatSl, locSl);
System.out.println("Same Output by using MessageFormat API only\n");
System.out.printf("%-16s%-16s%-16s\n", "Number", "English", "Slovenian");
for (int num : numbers) {
StringBuffer msgEn = new StringBuffer();
StringBuffer msgSl = new StringBuffer();
altMsgfmtEn.format(new Object[] {num}, msgEn, new FieldPosition(0));
altMsgfmtSl.format(new Object[] {num}, msgSl, new FieldPosition(0));
System.out.printf("%-16s%-16s%-16s\n", num, msgEn, msgSl);
}
/** output of the sample code:
********************************************************************
Number English Slovenian
0 0 dogs 0 psov
1 1 dog 1 pes
2 2 dogs 2 psa
3 3 dogs 3 psi
4 4 dogs 4 psi
5 5 dogs 5 psov
10 10 dogs 10 psov
100 100 dogs 100 psov
101 101 dogs 101 pes
102 102 dogs 102 psa
*******************************************************************/
Android reference for android.icu.text.PluralFormat.PluralFormat.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale, PluralRules+PluralType)
Creates a new PluralFormat for the plural type.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules$PluralType;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale, Android.Icu.Text.PluralRules.PluralType? type);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules$PluralType;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale * Android.Icu.Text.PluralRules.PluralType -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the default number formatting will be done using this locale.
The plural type (e.g., cardinal or ordinal).
- Attributes
Remarks
Creates a new PluralFormat for the plural type. The standard number formatting will be done using the given locale.
Android reference for android.icu.text.PluralFormat.PluralFormat.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale, PluralRules, String)
Creates a new cardinal-number PluralFormat for a given set of rules, a
pattern and a locale.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules;Ljava/lang/String;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale, Android.Icu.Text.PluralRules? rules, string? pattern);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules;Ljava/lang/String;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale * Android.Icu.Text.PluralRules * string -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the PluralFormat will be configured with
rules for this locale. This locale will also be used for standard
number formatting.
- rules
- PluralRules
defines the behavior of the PluralFormat
object.
- pattern
- String
the pattern for this PluralFormat.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given set of rules, a pattern and a locale.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(PluralRules, String)
Creates a new cardinal-number PluralFormat for a given set of rules and a
pattern.
[Android.Runtime.Register(".ctor", "(Landroid/icu/text/PluralRules;Ljava/lang/String;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Text.PluralRules? rules, string? pattern);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/text/PluralRules;Ljava/lang/String;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Text.PluralRules * string -> Android.Icu.Text.PluralFormat
Parameters
- rules
- PluralRules
defines the behavior of the PluralFormat
object.
- pattern
- String
the pattern for this PluralFormat.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given set of rules and a pattern. The standard number formatting will be done using the default FORMAT locale.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(String)
Creates a new cardinal-number PluralFormat for a given pattern string.
[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "", ApiSince=24)]
public PluralFormat(string? pattern);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : string -> Android.Icu.Text.PluralFormat
Parameters
- pattern
- String
the pattern for this PluralFormat.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given pattern string. The default FORMAT locale will be used to get the set of plural rules and for standard number formatting.
Java documentation for android.icu.text.PluralFormat.PluralFormat(java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(Locale)
Creates a new cardinal-number PluralFormat for a given
java.util.Locale.
[Android.Runtime.Register(".ctor", "(Ljava/util/Locale;)V", "", ApiSince=24)]
public PluralFormat(Java.Util.Locale? locale);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Locale;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Java.Util.Locale -> Android.Icu.Text.PluralFormat
Parameters
- locale
- Locale
the PluralFormat will be configured with
rules for this locale. This locale will also be used for standard
number formatting.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given java.util.Locale.
Java documentation for android.icu.text.PluralFormat.PluralFormat(java.util.Locale).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale)
Creates a new cardinal-number PluralFormat for a given locale.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the PluralFormat will be configured with
rules for this locale. This locale will also be used for standard
number formatting.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given locale.
Java documentation for android.icu.text.PluralFormat.PluralFormat(android.icu.util.ULocale).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(PluralRules)
Creates a new cardinal-number PluralFormat for a given set of rules.
[Android.Runtime.Register(".ctor", "(Landroid/icu/text/PluralRules;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Text.PluralRules? rules);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/text/PluralRules;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Text.PluralRules -> Android.Icu.Text.PluralFormat
Parameters
- rules
- PluralRules
defines the behavior of the PluralFormat
object.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given set of rules. The standard number formatting will be done using the default FORMAT locale.
Java documentation for android.icu.text.PluralFormat.PluralFormat(android.icu.text.PluralRules).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
PluralFormat(ULocale, PluralRules)
Creates a new cardinal-number PluralFormat for a given set of rules.
[Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules;)V", "", ApiSince=24)]
public PluralFormat(Android.Icu.Util.ULocale? ulocale, Android.Icu.Text.PluralRules? rules);
[<Android.Runtime.Register(".ctor", "(Landroid/icu/util/ULocale;Landroid/icu/text/PluralRules;)V", "", ApiSince=24)>]
new Android.Icu.Text.PluralFormat : Android.Icu.Util.ULocale * Android.Icu.Text.PluralRules -> Android.Icu.Text.PluralFormat
Parameters
- ulocale
- ULocale
the default number formatting will be done using this locale.
- rules
- PluralRules
defines the behavior of the PluralFormat
object.
- Attributes
Remarks
Creates a new cardinal-number PluralFormat for a given set of rules. The standard number formatting will be done using the given locale.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.