| Issue 7: | StringIndexOutOfBounds in joinWithString |
‹ Prev
5 of 5
|
| 1 person starred this issue and may be notified of changes. | Back to list |
This function throws a StringIndexOutOfBounds if the words collection is
empty ...
class SimpleNamingContext ... {
...
public static String joinWithString(String seperator, Collection<?>
words) {
String ret = "";
for (Object s: words) {
ret+=s.toString()+seperator;
}
return ret.substring(0, ret.length()-seperator.length());
}
|
|
|
|