snowe
02/18/2019, 6:35 PMhasNext()
method, so I cannot perform whether there is an end in the while
.
public static void printEachForward(BreakIterator boundary, String source) {
int start = boundary.first();
for (int end = boundary.next();
end != BreakIterator.DONE;
start = end, end = boundary.next()) {
System.out.println(source.substring(start,end));
}
}
Bilagi
02/18/2019, 6:37 PMfun printEachForward(boundary: BreakIterator, source: String) {
var start = boundary.first()
var end = boundary.next()
while (end != BreakIterator.DONE) {
println(source.substring(start, end))
start = end
end = boundary.next()
}
}
snowe
02/18/2019, 6:38 PM