mirror of
https://github.com/corda/corda.git
synced 2025-05-29 13:44:25 +00:00
implement a few more classpath methods
This commit is contained in:
parent
5e42158f4b
commit
2ca75d50e6
@ -336,6 +336,46 @@ public final class String implements Comparable<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] split(String s) {
|
||||||
|
String[] array = new String[(length / s.length) + 1];
|
||||||
|
int index = 0;
|
||||||
|
int last = 0;
|
||||||
|
int position = 0;
|
||||||
|
for (int i = 0; i < length - s.length + 1;) {
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < s.length; ++j) {
|
||||||
|
if (charAt(i + j) != s.charAt(j)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j == s.length) {
|
||||||
|
if (i > 0) {
|
||||||
|
if (i > position) {
|
||||||
|
last = index;
|
||||||
|
}
|
||||||
|
array[index++] = substring(position, i);
|
||||||
|
}
|
||||||
|
i = position = i + s.length;
|
||||||
|
} else {
|
||||||
|
++ i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (position < length) {
|
||||||
|
last = index;
|
||||||
|
array[index] = substring(position, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (last + 1 < array.length) {
|
||||||
|
String[] a = new String[last + 1];
|
||||||
|
System.arraycopy(array, 0, a, 0, last + 1);
|
||||||
|
array = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
public native String intern();
|
public native String intern();
|
||||||
|
|
||||||
public static String valueOf(Object s) {
|
public static String valueOf(Object s) {
|
||||||
|
@ -15,11 +15,24 @@ public class MessageFormat extends Format {
|
|||||||
this(pattern, Locale.getDefault());
|
this(pattern, Locale.getDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuffer format(Object o, StringBuffer target, FieldPosition p) {
|
public StringBuffer format(Object[] args, StringBuffer target,
|
||||||
|
FieldPosition p)
|
||||||
|
{
|
||||||
// todo
|
// todo
|
||||||
return target.append(pattern);
|
return target.append(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StringBuffer format(Object args, StringBuffer target, FieldPosition p)
|
||||||
|
{
|
||||||
|
return format((Object[]) args, target, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String format(String pattern, Object ... args) {
|
||||||
|
return new MessageFormat
|
||||||
|
(pattern).format(args, new StringBuffer(), new FieldPosition(0))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public void applyPattern(String pattern) {
|
public void applyPattern(String pattern) {
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user