mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-10646 String -> CharSequence
X-SVN-Rev: 35040
This commit is contained in:
parent
25459cba6b
commit
0b5902b94d
2 changed files with 4 additions and 4 deletions
icu4j/main/classes/core/src/com/ibm/icu
|
@ -51,7 +51,7 @@ public class SimplePatternFormatter {
|
|||
* @param pattern The string.
|
||||
* @return the new SimplePatternFormatter object.
|
||||
*/
|
||||
public static SimplePatternFormatter compile(String pattern) {
|
||||
public static SimplePatternFormatter compile(CharSequence pattern) {
|
||||
PlaceholdersBuilder placeholdersBuilder = new PlaceholdersBuilder();
|
||||
PlaceholderIdBuilder idBuilder = new PlaceholderIdBuilder();
|
||||
StringBuilder newPattern = new StringBuilder();
|
||||
|
@ -124,7 +124,7 @@ public class SimplePatternFormatter {
|
|||
/**
|
||||
* Formats the given values.
|
||||
*/
|
||||
public String format(String... values) {
|
||||
public String format(CharSequence... values) {
|
||||
return format(new StringBuilder(), null, values).toString();
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ public class SimplePatternFormatter {
|
|||
* @return appendTo
|
||||
*/
|
||||
public StringBuilder format(
|
||||
StringBuilder appendTo, int[] offsets, String... values) {
|
||||
StringBuilder appendTo, int[] offsets, CharSequence... values) {
|
||||
if (values.length < placeholderCount) {
|
||||
throw new IllegalArgumentException("Too few values.");
|
||||
}
|
||||
|
|
|
@ -628,7 +628,7 @@ public class MeasureFormat extends UFormat {
|
|||
QuantityFormatter countToFormat = styleToCountToFormat.get(formatWidth);
|
||||
SimplePatternFormatter formatter = countToFormat.getByVariant(keyword);
|
||||
int[] offsets = new int[1];
|
||||
formatter.format(appendTo, offsets, formattedNumber.toString());
|
||||
formatter.format(appendTo, offsets, formattedNumber);
|
||||
if (offsets[0] != -1) { // there is a number (may not happen with, say, Arabic dual)
|
||||
// Fix field position
|
||||
if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue