square / phrase
posted
Category: Utils
Minimum SDK Level: Honeycomb (11 | 3.0.x)

Badge

View in Github Github project information
Starred: 1117
Forks: 102
Watchers: 58
Open Issues: 8

Snapshot pictures

No snapshot for this library yet.

Description

CharSequence formatted = Phrase.from("Hi {first_name}, you are {age} years old.")
  .put("first_name", firstName)
  .put("age", age)
  .format();

Comma-separated lists:

CharSequence formattedList = ListPhrase.from(", ")
  .format(1, 2, 3);
// returns "1, 2, 3"

English sentence-style lists:

ListPhrase listFormatter = ListPhrase.from(
  " and ",
  ", ",
  ", and ");

listFormatter.format(Arrays.asList(1, 2));
// returns "1 and 2"

listFormatter.format(Arrays.asList(1, 2, 3));
// returns "1, 2, and 3"
1

See also