mirror of
https://github.com/corda/corda.git
synced 2025-06-14 05:08:18 +00:00
Added java.util.Formatter implementation. Basic/common formats work,
such as %s, %d, %x... also width, left justify, zerofill flags are implemented. Many of the other formats do not work, see the comments in avian.FormatString javadoc and look for FIXME and TODO items for more information on features that are known to not work correctly.
This commit is contained in:
@ -13,6 +13,7 @@ package java.lang;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Comparator;
|
||||
import java.util.Formatter;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -574,6 +575,20 @@ public final class String
|
||||
|
||||
public native String intern();
|
||||
|
||||
public static String format(String fmt, Object... args) {
|
||||
final Formatter formatter = new Formatter();
|
||||
final String result = formatter.format(fmt, args).toString();
|
||||
formatter.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String format(Locale l, String fmt, Object... args) {
|
||||
final Formatter formatter = new Formatter();
|
||||
final String result = formatter.format(l, fmt, args).toString();
|
||||
formatter.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String valueOf(Object s) {
|
||||
return s == null ? "null" : s.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user