我正在尝试从 POI 中引入空单元格。即使是关于如何从电子表格中获取价值的示例也会非常有帮助
am trying to bring in empty cells from POI. Even an example on how to bring in a value from a spreadsheet would be very helpful
我要查找电子表格中的空单元格。只是空单元格我已经编写了代码但是我在使用 if 语句时遇到问题我不确定如何检查空单元格
public class Parse {
public static void main(String[] args) throws Exception {
String splitBy = ",";
BufferedReader br = new BufferedReader(newFileReader("/Users/Adrian/Dropbox/Tedds/TestBeam.csv"));
String line = br.readLine();
while ((line = br.readLine()) != null) {
String[] a = line.split(splitBy);
String[] b = line.split(splitBy);
String[] h = line.split(splitBy);
String[] i = line.split(splitBy); // is 8 in
if(s.contains((" ")){
System.out.println("Error");}
System.out.println("Checked By " + h[7] + ","); }
br.close();
}}
即使是关于如何从电子表格中获取值的示例也会对了解如何着手非常有帮助
您似乎从某处复制了代码。此外,我在您的示例中没有看到任何 POI 代码
您不需要多次调用 split。
为数组中的每个字符串 s
遍历数组 a
检查值是否为空
while ((line = br.readLine()) != null) {
String[] a = line.split(splitBy);
for(String s: a){
if(s!=null && !s.trim().isEmpty()){
System.out.println("Error");
}
}
System.out.println("Checked By " + a[7] + ",");
}
我要查找电子表格中的空单元格。只是空单元格我已经编写了代码但是我在使用 if 语句时遇到问题我不确定如何检查空单元格
public class Parse {
public static void main(String[] args) throws Exception {
String splitBy = ",";
BufferedReader br = new BufferedReader(newFileReader("/Users/Adrian/Dropbox/Tedds/TestBeam.csv"));
String line = br.readLine();
while ((line = br.readLine()) != null) {
String[] a = line.split(splitBy);
String[] b = line.split(splitBy);
String[] h = line.split(splitBy);
String[] i = line.split(splitBy); // is 8 in
if(s.contains((" ")){
System.out.println("Error");}
System.out.println("Checked By " + h[7] + ","); }
br.close();
}}
即使是关于如何从电子表格中获取值的示例也会对了解如何着手非常有帮助
您似乎从某处复制了代码。此外,我在您的示例中没有看到任何 POI 代码
您不需要多次调用 split。
为数组中的每个字符串 s
遍历数组 a
检查值是否为空
while ((line = br.readLine()) != null) {
String[] a = line.split(splitBy);
for(String s: a){
if(s!=null && !s.trim().isEmpty()){
System.out.println("Error");
}
}
System.out.println("Checked By " + a[7] + ",");
}