code //////////////////////////////////////////// ////////////////////////////////////////////////// / String OldNode = "<NodeOne action=''Print?''/>";String NewNode = "<NodeOne action=''Print?''>empty</NodeOne>";XMLString = XMLString.replaceAll(OldNode,NewNode);System.out.println("new XMLString : "+XMLString.toString()); } }//////////////////////////////////////////Samplecode /////////////////////////////////////////////////////////////////////////////////////////////// 推荐答案 String OldNode ="< NodeOne action =''Print?''/>" ;; String NewNode =" ;< NodeOne action =''Print?''> empty< / NodeOne>" ;; XMLString = XMLString.replaceAll(OldNode,NewNode); System.out.println(" new XMLString:" + XMLString.toString()); } } ///////示例代码///////////////// String OldNode = "<NodeOne action=''Print?''/>";String NewNode = "<NodeOne action=''Print?''>empty</NodeOne>"; XMLString = XMLString.replaceAll(OldNode,NewNode);System.out.println("new XMLString : "+XMLString.toString()); }} ///////Sample code ///////////////// 您需要查看源帖子中的换行符到Usenet的位置。你有一个 流浪大于字符(''>'',又名,右尖括号) 属于xml PI,但是以某种方式移动到另一条线。 此外,作为变量的变量XMLString应该以 小写字母开头,约定。 You need to watch where line breaks go in source posts to Usenet. You got astray greater-than character (''>'', a.k.a., "right angle bracket") thatbelonged with the xml PI, but was somehow moved to a different line. Also, the variable "XMLString", being a variable, should start with alower-case letter, by convention. + + 您是否在replaceAll()方法上阅读了Javadocs? < http://java.sun.com/javase/6 /docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.la ng.String)> 第一个参数是正则表达式,其中问号有 特殊意义。 - Lew Did you read the Javadocs on the replaceAll() method?<http://java.sun.com/javase/6/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.la ng.String)> The first argument is a regular expression, in which the question mark hasspecial significance. --Lew 您需要查看源帖子中的换行符到Usenet的位置。你有一个 流浪大于字符(''>'',又名,右尖括号) 属于xml PI,但是不知何故搬到了不同的路线。 You need to watch where line breaks go in source posts to Usenet. You got astray greater-than character (''>'', a.k.a., "right angle bracket") thatbelonged with the xml PI, but was somehow moved to a different line. 来吧,伙计!你是如此愚蠢,不明白代码 的工作原理,你可能需要移动支架,它在运行它的时候是什么, !br /> Come on, dude! Are you so stupid, to not understand that the codeworks, and you may need to move the bracket, where it supposes to be,when running it! 你在哪里得到了这条规则,Conformist先生! 不要在这里向任何人讲课,这是胡说八道的规则!试着想出 这个盒子吧! Where did you get that rule, Mr. Conformist!Don''t lecture to anyone here, your nonsense rule! Try to think out ofthe box sometime! + + 您是否读过Javadocs replaceAll()方法? < http://java.sun.com/javase/6/docs/api/java/lang/String.html#replaceAl ...)> 第一个参数是正则表达式,其中问号具有 特殊意义。 Did you read the Javadocs on the replaceAll() method?<http://java.sun.com/javase/6/docs/api/java/lang/String.html#replaceAl...)>The first argument is a regular expression, in which the question mark hasspecial significance. 但是你从来没有回答过我的问题!看看Roedy 回复给我的是什么!这是一个答案,我一直在寻找! But you never answered my question though! Take a look what Roedyreplied to me! That''s kind of an answer, I was looking for! 这篇关于“replaceAll”如果是“?”,则String Class的方法不起作用。 character是XMLString属性的值!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-01 13:11