mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Implement String.format
This commit is contained in:
parent
5109691a8d
commit
6d5b4a67e5
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.teavm.classlib.java.io.TSerializable;
|
||||
import org.teavm.classlib.java.io.TUnsupportedEncodingException;
|
||||
import org.teavm.classlib.java.nio.TByteBuffer;
|
||||
|
@ -23,6 +24,7 @@ import org.teavm.classlib.java.nio.charset.TCharset;
|
|||
import org.teavm.classlib.java.nio.charset.impl.TUTF8Charset;
|
||||
import org.teavm.classlib.java.util.TArrays;
|
||||
import org.teavm.classlib.java.util.TComparator;
|
||||
import org.teavm.classlib.java.util.TFormatter;
|
||||
import org.teavm.classlib.java.util.THashMap;
|
||||
import org.teavm.classlib.java.util.TMap;
|
||||
import org.teavm.classlib.java.util.regex.TPattern;
|
||||
|
@ -642,4 +644,12 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
public String replaceFirst(String regex, String replacement) {
|
||||
return TPattern.compile(regex).matcher(toString()).replaceFirst(replacement);
|
||||
}
|
||||
|
||||
public static String format(String format, Object... args) {
|
||||
return new TFormatter().format(format, args).toString();
|
||||
}
|
||||
|
||||
public static String format(Locale l, String format, Object... args) {
|
||||
return new TFormatter(l).format(format, args).toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user