PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352930 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-11-28 19:26:20 +00:00
parent 5ab7cb4360
commit 1e00d428ad

View File

@ -57,6 +57,7 @@ package org.apache.poi.hssf.util;
/** /**
* *
* @author Avik Sengupta * @author Avik Sengupta
* @author Dennis Doubleday (patch to seperateRowColumns())
*/ */
public class CellReference { public class CellReference {
@ -126,11 +127,18 @@ public class CellReference {
* number format. * number format.
*/ */
private String[] seperateRowColumns(String reference) { private String[] seperateRowColumns(String reference) {
int loc = 0; // location of first number
// Look for end of sheet name. This will either set
// start to 0 (if no sheet name present) or the
// index after the sheet reference ends.
int start = reference.indexOf("!") + 1;
String retval[] = new String[2]; String retval[] = new String[2];
int length = reference.length(); int length = reference.length();
char[] chars = reference.toCharArray(); char[] chars = reference.toCharArray();
int loc = start;
if (chars[loc]=='$') loc++; if (chars[loc]=='$') loc++;
for (; loc < chars.length; loc++) { for (; loc < chars.length; loc++) {
if (Character.isDigit(chars[loc]) || chars[loc] == '$') { if (Character.isDigit(chars[loc]) || chars[loc] == '$') {
@ -139,7 +147,7 @@ public class CellReference {
} }
retval[0] = reference.substring(0,loc); retval[0] = reference.substring(start,loc);
retval[1] = reference.substring(loc); retval[1] = reference.substring(loc);
return retval; return retval;
} }