Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change stringbuffer.java/stringbuilder.java #3736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion vm/JavaAPI/src/java/lang/StringBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,18 @@ public StringBuffer insert(final int offset, final CharSequence cs, final int st
return this;
}

public CharSequence subSequence(int start, int end) {
/*public CharSequence subSequence(int start, int end) {
return internal.substring(start, end);
}*/
public static String substring(StringBuilder str, int from, int to)
{
int len = to-from;
char seq[] = new char[len];
for (int x = 0; x < len; x++)
{
seq[i] = str.charAt(from++);
}
return(new String(seq));
}


Expand Down
16 changes: 14 additions & 2 deletions vm/JavaAPI/src/java/lang/StringBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,21 @@ public StringBuilder insert(final int offset, final CharSequence cs, final int s
}

@Override
public CharSequence subSequence(int start, int end) {
return substring(start,end);
public static String substring(StringBuilder str, int from, int to)
{
int len = to-from;
char seq[] = new char[len];
for (int x = 0; x < len; x++)
{
seq[i] = str.charAt(from++);
}
return(new String(seq));
}
/*public CharSequence subSequence(int start, int end) {
return substring(start,end);
}*/



public StringBuilder substring(int start, int end) {
return new StringBuilder(value, start, end-start);
Expand Down