我有一个java问题。当遇到一个或多个“#”实例时,我不知道如何编写正则表达式以将某些内容打印到文件中。“”时不能打印, “#”string equals
时必须打印。string equals
这是我的代码:
int num = 1;
StringBuffer noletterbuf = new StringBuffer(nospaces);
noletterbuf.deleteCharAt(0);
String noletter = noletterbuf.toString();
//if(num == noletter.split("[^#]").length){//applies # to C# and C
if(num == noletter.split("[#*]").length){//applies # to C
double yacc = octave*-50;
p6.println("sb.append(\"/Times-Roman findfont 70 scalefont setfont 1 -1 scale newpath \"); sb.append(" + xaccplace + " + \" \" +" + yacc + " + \" moveto \"); sb.append(\"( # ) show 1 -1 scale \");");
}
提前致谢!比约恩