java基础(字符串),字符串中带有 "-"的拆分
String strKey ="3-6";
String[] parts = strKey.split("-");
int row1 = -1;
int col1 = -1;
if(!StringUtils.isEmpty(parts[0])){
row1 = Integer.parseInt(parts[0]);//行号
}
if(!StringUtils.isEmpty(parts[1])){
col1 = Integer.parseInt(parts[1]);//列号
}
system.out.println("row1="+row1+",col1="+col1);