use StringBuffer->String->Integer.e.g.1:StringBuffer buf=new StringBuffer("1");
for(int i=0;i<6;i++){
buf.append(4);
}
buf.append(9);
int x=Integer.parseInt(buf.toString());
for(int i=0;i<6;i++){
buf.append(4);
}
buf.append(9);
int x=Integer.parseInt(buf.toString());
2.(12)*//匹配所有包含12的字符串,如果要完全匹配则:^(12)+$,这个表示必须至少有一个12,而且必须是12组合,匹配12,1212,121212等,不匹配空字符串,1,121,12121等
我希望能用正则表达式解决这个问题。
问题是事先不知道是哪个数字重复啊,后两个模式也是不确定数字的,提供的数字只是做例子说明。