if( sURL.endsWith(".png") ) {\r
imageType = Workbook.PICTURE_TYPE_PNG;\r
}\r
- else if( sURL.endsWith("jpg") || sURL.endsWith(".jpeg") ) {\r
+ else if( sURL.endsWith(".jpg") || sURL.endsWith(".jpeg") ) {\r
imageType = Workbook.PICTURE_TYPE_JPEG;\r
}\r
else {\r
public FreeRefFunction findFunction(String name) {
// functions that are available in Excel 2007+ have a prefix _xlfn.
// if you save such a .xlsx workbook as .xls
- if(name.startsWith("_xlfn.")) name = name.substring(6);
+ final String prefix = "_xlfn.";
+ // case-sensitive
+ if(name.startsWith(prefix)) name = name.substring(prefix.length());
// FIXME: inconsistent case-sensitivity
return _functionsByName.get(name.toUpperCase(Locale.ROOT));
package org.apache.poi.ss.util;
+import static org.apache.poi.util.StringUtil.endsWithIgnoreCase;
+
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
* delimited and escaped as per normal syntax rules for formulas.
*/
public CellReference(String cellRef) {
- if(cellRef.toUpperCase(Locale.ROOT).endsWith("#REF!")) {
+ if(endsWithIgnoreCase(cellRef, "#REF!")) {
throw new IllegalArgumentException("Cell reference invalid: " + cellRef);
}
==================================================================== */
package org.apache.poi.hsmf.extractor;
+import static org.apache.poi.util.StringUtil.startsWithIgnoreCase;
+
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
// Failing that try via the raw headers
String[] headers = msg.getHeaders();
for(String header: headers) {
- if(header.toLowerCase(Locale.ROOT).startsWith("date:")) {
+ if(startsWithIgnoreCase(header, "date:")) {
s.append(
"Date:" +
header.substring(header.indexOf(':')+1) +