if (StringUtils.hasText(specName))
{
Pattern pattern = Pattern.compile("[0-9]+(\\.[0-9]+)?");
Matcher match = pattern.matcher(specName);
for (int j = 0; match.find() && j <= 2; j++)
{
String value = match.group();
if (value != null && SolrStatementUtils.checkTextToNum(value))
{
double num = Double.parseDouble(value);
if (j == 0)
{
itemIndex.setThickness(NumberUtils.parseDouble(SolrStatementUtils.formatNumber(Double.parseDouble(value), SolrStatementUtils.NUMBER_PATTERN_1)));
}
if (j == 1)
{
itemIndex.setWidth(NumberUtils.parseDouble(SolrStatementUtils.formatNumber(Double.parseDouble(value), SolrStatementUtils.NUMBER_PATTERN_1)));
}
if (j == 2)
{
itemIndex.setLength(NumberUtils.parseDouble(SolrStatementUtils.formatNumber(Double.parseDouble(value), SolrStatementUtils.NUMBER_PATTERN_1)));
}
specName = specName.replace(value, SolrStatementUtils.formatDecNumber(num, "####.##"));
}
}
/**
* 中文提取
* @param str
* @author Admin
* @date 2015-7-25
*/
public static void getChinese(String str){
String regex = "[//u4E00-//u9FFF]+";//[//u4E00-//u9FFF]为汉字
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);
StringBuffer sb = new StringBuffer();
while(matcher.find()){
sb.append(matcher.group());
}
System.out.println(sb);
}