Add a clear function to String
Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com> Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
9ba3105b1b
commit
a3a2c62d4b
Binary file not shown.
@ -57,6 +57,11 @@ public class String{
|
|||||||
return this.sb.indexOf(str);
|
return this.sb.indexOf(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
this.sb.setLength(0);
|
||||||
|
bounds = new Point(0,1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the index within this string of the first occurrence of the
|
* Returns the index within this string of the first occurrence of the
|
||||||
* specified substring, starting at the specified index.
|
* specified substring, starting at the specified index.
|
||||||
|
@ -80,8 +80,12 @@ public class EditorRenderer extends LevelRenderer{
|
|||||||
if (messageLog.length()>0) {
|
if (messageLog.length()>0) {
|
||||||
if (System.currentTimeMillis()-last_message_log>MESSAGE_TIME) {
|
if (System.currentTimeMillis()-last_message_log>MESSAGE_TIME) {
|
||||||
last_message_log=System.currentTimeMillis();
|
last_message_log=System.currentTimeMillis();
|
||||||
|
if (messageLog.length()>1) {
|
||||||
int secondMarker = messageLog.indexOf("\n",messageLog.indexOf("\n")+1);
|
int secondMarker = messageLog.indexOf("\n",messageLog.indexOf("\n")+1);
|
||||||
messageLog.replace(messageLog.indexOf("\n"), secondMarker==-1?messageLog.length():secondMarker, "");
|
messageLog.replace(messageLog.indexOf("\n"), secondMarker==-1?messageLog.length():secondMarker, "");
|
||||||
|
} else {
|
||||||
|
messageLog.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user