ListFormatter
class ListFormatter
| kotlin.Any | |
| ↳ | android.icu.text.ListFormatter | 
Immutable class for formatting a list, using data from CLDR (or supplied separately). The class is not subclassable.
Summary
| Nested classes | |
|---|---|
| 
            
             An immutable class containing the result of a list formatting operation.  | 
        |
| 
            
             Type of meaning expressed by the list.  | 
        |
| 
            
             Verbosity level of the list patterns.  | 
        |
| Public methods | |
|---|---|
| String! | 
            
             Format a list of objects.  | 
        
| String! | 
            format(items: MutableCollection<*>!)Format a collection of objects.  | 
        
| ListFormatter.FormattedList! | 
            formatToValue(vararg items: Any!)Format a list of objects to a FormattedList.  | 
        
| ListFormatter.FormattedList! | 
            formatToValue(items: MutableCollection<*>!)Format a collection of objects to a FormattedList.  | 
        
| static ListFormatter! | 
            
             Create a list formatter that is appropriate for the default FORMAT locale.  | 
        
| static ListFormatter! | 
            getInstance(locale: ULocale!)Create a list formatter that is appropriate for a locale.  | 
        
| static ListFormatter! | 
            getInstance(locale: ULocale!, type: ListFormatter.Type!, width: ListFormatter.Width!)Create a list formatter that is appropriate for a locale.  | 
        
| static ListFormatter! | 
            getInstance(locale: Locale!)Create a list formatter that is appropriate for a locale.  | 
        
| static ListFormatter! | 
            getInstance(locale: Locale!, type: ListFormatter.Type!, width: ListFormatter.Width!)Create a list formatter that is appropriate for a locale.  | 
        
| String! | 
            getPatternForNumItems(count: Int)Returns the pattern to use for a particular item count.  | 
        
Public methods
format
fun format(vararg items: Any!): String!
Format a list of objects.
| Parameters | |
|---|---|
items | 
            Any!: items to format. The toString() method is called on each. | 
| Return | |
|---|---|
String! | 
            items formatted into a string | 
format
fun format(items: MutableCollection<*>!): String!
Format a collection of objects. The toString() method is called on each.
| Parameters | |
|---|---|
items | 
            MutableCollection<*>!: items to format. The toString() method is called on each. | 
| Return | |
|---|---|
String! | 
            items formatted into a string | 
formatToValue
fun formatToValue(vararg items: Any!): ListFormatter.FormattedList!
Format a list of objects to a FormattedList. You can access the offsets of each element from the FormattedList.
| Parameters | |
|---|---|
items | 
            Any!: items to format. The toString() method is called on each. | 
| Return | |
|---|---|
ListFormatter.FormattedList! | 
            items formatted into a FormattedList | 
formatToValue
fun formatToValue(items: MutableCollection<*>!): ListFormatter.FormattedList!
Format a collection of objects to a FormattedList. You can access the offsets of each element from the FormattedList.
| Parameters | |
|---|---|
items | 
            MutableCollection<*>!: items to format. The toString() method is called on each. | 
| Return | |
|---|---|
ListFormatter.FormattedList! | 
            items formatted into a FormattedList | 
getInstance
static fun getInstance(): ListFormatter!
Create a list formatter that is appropriate for the default FORMAT locale.
| Return | |
|---|---|
ListFormatter! | 
            ListFormatter | 
getInstance
static fun getInstance(locale: ULocale!): ListFormatter!
Create a list formatter that is appropriate for a locale.
| Parameters | |
|---|---|
locale | 
            ULocale!: the locale in question. | 
| Return | |
|---|---|
ListFormatter! | 
            ListFormatter | 
getInstance
static fun getInstance(
locale: ULocale!,
type: ListFormatter.Type!,
width: ListFormatter.Width!
): ListFormatter!
Create a list formatter that is appropriate for a locale.
| Parameters | |
|---|---|
locale | 
            ULocale!: the locale in question. | 
| Return | |
|---|---|
ListFormatter! | 
            ListFormatter | 
getInstance
static fun getInstance(locale: Locale!): ListFormatter!
Create a list formatter that is appropriate for a locale.
| Parameters | |
|---|---|
locale | 
            Locale!: the locale in question. | 
| Return | |
|---|---|
ListFormatter! | 
            ListFormatter | 
getInstance
static fun getInstance(
locale: Locale!,
type: ListFormatter.Type!,
width: ListFormatter.Width!
): ListFormatter!
Create a list formatter that is appropriate for a locale.
| Parameters | |
|---|---|
locale | 
            Locale!: the locale in question. | 
| Return | |
|---|---|
ListFormatter! | 
            ListFormatter | 
getPatternForNumItems
fun getPatternForNumItems(count: Int): String!
Returns the pattern to use for a particular item count.
| Parameters | |
|---|---|
count | 
            Int: the item count. | 
| Return | |
|---|---|
String! | 
            the pattern with {0}, {1}, {2}, etc. For English, getPatternForNumItems(3) == "{0}, {1}, and {2}" | 
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException | 
            when count is 0 or negative. |