replace for-loop over index with for-each loop

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1752788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-07-15 07:41:26 +00:00
parent 1c0a2bd670
commit f7fa4f4384
1 changed files with 2 additions and 3 deletions

View File

@ -157,8 +157,7 @@ public abstract class TextFunction implements Function {
public static final Function CLEAN = new SingleArgTextFunc() { public static final Function CLEAN = new SingleArgTextFunc() {
protected ValueEval evaluate(String arg) { protected ValueEval evaluate(String arg) {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (int i = 0; i < arg.length(); i++) { for (final char c : arg.toCharArray()) {
char c = arg.charAt(i);
if (isPrintable(c)) { if (isPrintable(c)) {
result.append(c); result.append(c);
} }
@ -178,7 +177,7 @@ public abstract class TextFunction implements Function {
* @return whether the character is printable * @return whether the character is printable
*/ */
private boolean isPrintable(char c){ private boolean isPrintable(char c){
return (int) c >= 32; return c >= 32;
} }
}; };