replaced commented code with 'if (false)' block
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@893395 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3bbde4880c
commit
56c40e3a0f
@ -214,9 +214,9 @@ public class DateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String fs = formatString;
|
String fs = formatString;
|
||||||
/*
|
if (false) {
|
||||||
Normalize the format string. The code below is equivalent
|
// Normalize the format string. The code below is equivalent
|
||||||
to the following consecutive regexp replacements:
|
// to the following consecutive regexp replacements:
|
||||||
|
|
||||||
// Translate \- into just -, before matching
|
// Translate \- into just -, before matching
|
||||||
fs = fs.replaceAll("\\\\-","-");
|
fs = fs.replaceAll("\\\\-","-");
|
||||||
@ -231,27 +231,27 @@ public class DateUtil {
|
|||||||
// switching stuff, which we can ignore
|
// switching stuff, which we can ignore
|
||||||
fs = fs.replaceAll(";@", "");
|
fs = fs.replaceAll(";@", "");
|
||||||
|
|
||||||
The code above was reworked as suggested in bug 48425:
|
// The code above was reworked as suggested in bug 48425:
|
||||||
simple loop is more efficient than consecutive regexp replacements.
|
// simple loop is more efficient than consecutive regexp replacements.
|
||||||
*/
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder(fs.length());
|
||||||
for(int i = 0; i < fs.length(); i++){
|
for (int i = 0; i < fs.length(); i++) {
|
||||||
char c = fs.charAt(i);
|
char c = fs.charAt(i);
|
||||||
if(i < fs.length() - 1){
|
if (i < fs.length() - 1) {
|
||||||
char nc = fs.charAt(i + 1);
|
char nc = fs.charAt(i + 1);
|
||||||
if(c == '\\'){
|
if (c == '\\') {
|
||||||
switch (nc){
|
switch (nc) {
|
||||||
case '-':
|
case '-':
|
||||||
case ',':
|
case ',':
|
||||||
case '.':
|
case '.':
|
||||||
case ' ':
|
case ' ':
|
||||||
case '\\':
|
case '\\':
|
||||||
//skip current '\' and continue to the next char
|
// skip current '\' and continue to the next char
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (c == ';' && nc == '@'){
|
} else if (c == ';' && nc == '@') {
|
||||||
i++;
|
i++;
|
||||||
//skip ";@" duplets
|
// skip ";@" duplets
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user