What steps will reproduce the problem?
1. class: com.google.minijoe.samples.runtime.Context2D
2. Method: static String[] split(String s, char c)
3. LineNmuber: 174
4. Version: r23
What is the expected output? What do you see instead?
input: split("0,0,0",',');
expected output: String[]{"0", "0", "0"};
actually output: String[]{"0",null,null};
What version of the product are you using? On what operating system?
minijoe:minijoe-1.0.zip
OS:windows-xp-sp3 + Java-6-u17
Please provide any additional information below.
the split() method maybe:
static String[] split(String s, char c) {
int count = 1;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == c) {
count++;
}
}
String[] parts = new String[count];
int lastCut = 0;
int n = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == c) {
parts[n++] = s.substring(lastCut, i);
lastCut = i + 1;
}
}
parts[n] = s.substring(lastCut, s.length());
return parts;
}
Original issue reported on code.google.com by notm...@gmail.com on 29 Jun 2010 at 2:59
Original issue reported on code.google.com by
notm...@gmail.com
on 29 Jun 2010 at 2:59