??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品国产三级国产专区53
,亚洲天堂视频在线观看,盗摄牛牛av影视一区二区 http://www.aygfsteel.com/yydy1983/zh-cn Wed, 18 Jun 2025 05:52:25 GMT Wed, 18 Jun 2025 05:52:25 GMT 60 [JS]jQuery中attr和propҎ(gu)的区?/title> http://www.aygfsteel.com/yydy1983/archive/2015/01/21/422322.html♂游泳的?/dc:creator>♂游泳的?/author>Wed, 21 Jan 2015 06:33:00 GMT http://www.aygfsteel.com/yydy1983/archive/2015/01/21/422322.html http://www.aygfsteel.com/yydy1983/comments/422322.html http://www.aygfsteel.com/yydy1983/archive/2015/01/21/422322.html#Feedback 1 http://www.aygfsteel.com/yydy1983/comments/commentRss/422322.html http://www.aygfsteel.com/yydy1983/services/trackbacks/422322.html jQuery教程(29)-jQuery插g开发之为插件方法指定参?/a>
jQuery教程(28)-jQuery插g开发之使用插g
jQuery教程(27)-jQueryajax操作之修攚w认选项
jQuery教程(26)-ajax操作之用JSONP加蝲q程数据 阅读全文 ]]> Android官方技术文翻译—?Eclilpse目q移 http://www.aygfsteel.com/yydy1983/archive/2015/01/14/422223.html♂游泳的?/dc:creator>♂游泳的?/author>Wed, 14 Jan 2015 05:31:00 GMT http://www.aygfsteel.com/yydy1983/archive/2015/01/14/422223.html http://www.aygfsteel.com/yydy1983/comments/422223.html http://www.aygfsteel.com/yydy1983/archive/2015/01/14/422223.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/422223.html http://www.aygfsteel.com/yydy1983/services/trackbacks/422223.html android学习(fn)W记Q?1Qandroid选项菜单和子菜单QSubMenu )
android学习(fn)W记Q?0QNotification的功能与用法
android学习(fn)W记Q?2Qandroid使用监听器来监听菜单事g
android学习(fn)W记Q?3Qandroid创徏单选菜单和复选菜?/a> 阅读全文 ]]> Java获取当前路径和读取文?/title> http://www.aygfsteel.com/yydy1983/archive/2015/01/06/422074.html♂游泳的?/dc:creator>♂游泳的?/author>Tue, 06 Jan 2015 05:39:00 GMT http://www.aygfsteel.com/yydy1983/archive/2015/01/06/422074.html http://www.aygfsteel.com/yydy1983/comments/422074.html http://www.aygfsteel.com/yydy1983/archive/2015/01/06/422074.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/422074.html http://www.aygfsteel.com/yydy1983/services/trackbacks/422074.html System.out.println(System.getProperty("user.dir"));//user.dir指定?jin)当前的路?android开?/a> 阅读全文 ]]> Android Context 上下?你必ȝ道的一?/title> http://www.aygfsteel.com/yydy1983/archive/2015/01/05/422056.html♂游泳的?/dc:creator>♂游泳的?/author>Mon, 05 Jan 2015 05:40:00 GMT http://www.aygfsteel.com/yydy1983/archive/2015/01/05/422056.html http://www.aygfsteel.com/yydy1983/comments/422056.html http://www.aygfsteel.com/yydy1983/archive/2015/01/05/422056.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/422056.html http://www.aygfsteel.com/yydy1983/services/trackbacks/422056.html Android KSOAP2调用.net webservice
jQuery教程(8)-DOM?wi)操作之使用反向插入?gu)
android学习(fn)W记Q?4Q用AlertDialog创徏单对话框
android学习(fn)W记Q?3Q画廊视图(Gallery)的功能和用法
android na 阅读全文 ]]> javascript技术难点(三)(j)之this、new、apply和call详解 http://www.aygfsteel.com/yydy1983/archive/2014/12/09/421229.html♂游泳的?/dc:creator>♂游泳的?/author>Tue, 09 Dec 2014 09:54:00 GMT http://www.aygfsteel.com/yydy1983/archive/2014/12/09/421229.html http://www.aygfsteel.com/yydy1983/comments/421229.html http://www.aygfsteel.com/yydy1983/archive/2014/12/09/421229.html#Feedback 1 http://www.aygfsteel.com/yydy1983/comments/commentRss/421229.html http://www.aygfsteel.com/yydy1983/services/trackbacks/421229.html 讲解this指针的原理是个很复杂的问题,如果我们从javascript里this的实现机制来说明thisQ很多朋友可能会(x)来糊? by:萌萌的it?/a>
更多关于 android开?/a> 的文?nbsp; 阅读全文 ]]> 正则表达式和grep命o(h)的用?/title> http://www.aygfsteel.com/yydy1983/archive/2014/11/27/420790.html♂游泳的?/dc:creator>♂游泳的?/author>Thu, 27 Nov 2014 09:43:00 GMT http://www.aygfsteel.com/yydy1983/archive/2014/11/27/420790.html http://www.aygfsteel.com/yydy1983/comments/420790.html http://www.aygfsteel.com/yydy1983/archive/2014/11/27/420790.html#Feedback 1 http://www.aygfsteel.com/yydy1983/comments/commentRss/420790.html http://www.aygfsteel.com/yydy1983/services/trackbacks/420790.html
萌萌的it?/a> 阅读全文 ]]> 2.5 使用正则表达式进行替?/title> http://www.aygfsteel.com/yydy1983/articles/246997.html♂游泳的?/dc:creator>♂游泳的?/author>Wed, 17 Dec 2008 17:01:00 GMT http://www.aygfsteel.com/yydy1983/articles/246997.html http://www.aygfsteel.com/yydy1983/comments/246997.html http://www.aygfsteel.com/yydy1983/articles/246997.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/246997.html http://www.aygfsteel.com/yydy1983/services/trackbacks/246997.html 2.5 使用正则表达式进行替?/strong>
在上一节中Q介l了(jin)用于匚w一个String中的模式和用于从一个子模式l中(g)索数据的正则表达式。用regexQ还可以用新的值替代匹配的模式。完成此操作的一U方法是使用MatchercȝreplaceAllҎ(gu)Q它?yu)返回一个字W串Q将所有匹配的子串替换为给定的字符丌Ӏؓ(f)?jin)说明此?gu)Q查找一个文件内出现的所有repetition单词q用单词duplication来替换它们:(x)
String data = getStringData();
Pattern repPattern = Pattern.compile("(\\s)(repetition)([\\s;\\ .,])");
Matcher repMatcher = repPattern.matcher(data);
String newData = repMatcher.replaceAll("$1duplication$3");
Z(jin)查找单词Q需要捕获它前后的空?或标点符?。需要注意的是,如果此单词出现在data字符串的开_(d)那么上述的代码不?x)匹配它Q因为已假定它的前后存在I白W。除?jin)单词repetition被替换外Q我们希望文本中的其他内容与原始文本保持一_(d)包括单词周围的空白字W。这里的元W号($)昄不表C币。它表示对从regex模式中捕L(fng)l?和组3的逆向引用Q包含最初匹配的I白或标点符受这P与它们对应的值将插入到替换文本中?/p>
Stringc?在JDK 1.4或更高的版本?有一个replaceAllҎ(gu)Q其工作机制cM于Matcher中的replaceAllҎ(gu)。这使得它可以很方便地替换一个与模式匚w的子Ԍ(x)
replaceAllҎ(gu)q回一个新的字W串Q其中所有匹配的部分已被新值替换。但是,使用Matcher仍有很多优点Q因为相对于字符串它有更大的灉|性?/p>
可以使用Matcher的find循环用新gơ替换每个匹配的部分。这样你能够更好地控制替换q程。比如,可以在每ơ匹配的q程中应用其他逻辑Q甚xơ可以替换不同的倹{这qC(jin)StringBufferQStringBuffer用于保存更新的文本,q且一旦调用appendReplacementҎ(gu)QMatcherp加更新后的文本到~存中。在处理每个匚wq执行替换后Q需要用appendTailҎ(gu)最后一ơ匹配后的剩余字W串攄在输出缓存中。图2-1说明?jin)子串匹配和q两U方法之间的关系?br />
?-1 MatchercȝappendҎ(gu)
Matcher有一个相应的append指针。指针最初从零开始,随着每次调用appendReplacement向前Ud。这U设计是Z(jin)在一个find循环内用它。每ơ匹配后Q调用appendReplacementҎ(gu)QMatcher指针所在的上一个位|到匚w之前指针所在的位置之间的内容,x更改的文本合q到StringBuffer中。然后,Matcher替换当前匚w的文本ƈ替换后的内Ҏ(gu)|在StringBuffer中。接下来QMatcherappend指针Ud到当前匹配结之后的W一个字W,然后重复此过E直C再生匹配。在扑ֈ所有匹配之后很可能剩下一个未匚w的部分。ؓ(f)?jin)将q部分文本添加到输出StringBuffer中,使用appendTailҎ(gu)?br />
现在使用q些Ҏ(gu)前面的替换例子重写Z个@环。但是这一ơ对于每个匹配,用一个随机选择的同义词(repetition、duplication、copying、reiteration、recurrence或redundancy)来替代单词repetitionQ?
StringBuffer result = new StringBuffer();
String[] wordChoices = new String[]
{"repetition", "duplication", "copying",
"reiteration", "recurrence", "redundancy"};
Random rand = new Random();
String data = getStringData();
Pattern repPattern = Pattern.compile("(\\s)(repetition)([\\s;\\ .,])");
Matcher repMatcher = repPattern.matcher(data);
while (repMatcher.find()) {
// pick a word at random
int wordIndex = rand.nextInt(wordChoices.length);
String replacement = "$1" + wordChoices[wordIndex] + "$3";
repMatcher.appendReplacement(result, replacement);
}
repMatcher.appendTail(result);
System.out.println(result);
可以按需求改写find循环中的逻辑来对每个匚wq行所需的处理。此外,q可以用前面讨的Matcher的方法:(x)group、start和end。可以用这些技术的l合有选择CҎ(gu)删除一个文件中每部分匹配的文本?
]]> 2.4 使用Regex捕获l?/title> http://www.aygfsteel.com/yydy1983/articles/245894.html♂游泳的?/dc:creator>♂游泳的?/author>Fri, 12 Dec 2008 03:38:00 GMT http://www.aygfsteel.com/yydy1983/articles/245894.html http://www.aygfsteel.com/yydy1983/comments/245894.html http://www.aygfsteel.com/yydy1983/articles/245894.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/245894.html http://www.aygfsteel.com/yydy1983/services/trackbacks/245894.html 2.4 使用Regex捕获l?
在上一节中Q介l了(jin)如何使用正则表达式在一个文件中q行搜烦(ch)以便(g)索它内部所有的URL。可以用Matchercȝfind、start和endҎ(gu)来检索匹配的URL字符丌Ӏ有时有必要q一步处理子串匹配的l果Q或是查N加的子模式。例如,Ҏ(gu)个特定区域的URL不进行处理。ؓ(f)?jin)实现此目的Q一U强制性的Ҏ(gu)是用另一个Pattern和Matcher对象Q代码如下:(x)
// assume urlMatcher instance as in the previous example
while (urlMatcher.find()) {
int startIndex = urlMatcher.start();
int endIndex = urlMatcher.end();
String currentMatch = data.substring(startIndex, endIndex);
// the brute force approach, using a new pattern!
Pattern restricted = Pattern.compile(".*(abc|cbs|nbc)\\.com.*");
Matcher restrictMatcher = restricted.matcher(currentMatch);
if (!restrictMatcher.matches()) {
System.out.println(currentMatch);
}
}
在捕L(fng)URL中匹配域名ƈ不是一个非帔R效的Ҏ(gu)。由于已l用findҎ(gu)完成?jin)提取URL的困隑ַ作,不应该仅仅ؓ(f)?jin)获得结果的一部分而编写另一个regexQƈ且也不必q样做。正则表辑ּ允许模式分解成子序列。用圆括号Q将以后要用到的模式部分括v来,q样Q我们就可以忽略其余部分单独dq些部分的倹{重写URL模式以域名可以与URL的其他部分相分离Q?/p>
String urlPattern =
"(http|https|ftp)://([a-zA-Z0-9-\\.]+)[/\\w\\.\\-\\+\\?%=&;:,#]*";
当在模式中存在用括号括v来的l时Q可以分别检索每个组的匹配倹{从最左边的组开始编?Q然后依ơ对每对括号相对应的l进行编受在上面的模式中Q第一l是协议(如http)Q第二组是域名。ؓ(f)?jin)在匚w的字W串中访问组Q可以用Matcher的groupҎ(gu)。下面的代码CZ从每个URL中检索域名ƈ昄它们的|(x)
String data = getStringData(); // load the document
String urlString =
"(http|https|ftp)://([a-zA-Z0-9-\\.]+)[/\\w\\.\\-\\+\\?%=&;:,#]*";
Pattern urlPattern = Pattern.compile(urlString);
Matcher urlMatcher = urlPattern.matcher(data);
// print out the domain from each URL
while (urlMatcher.find()) {
String domain = urlMatcher.group(2); // 2nd group is the domain
System.out.println(domain);
}
保存每个匚w的组以便可以随后引用它们。在一个模式内引用一个以前的匚wl称为逆向引用(backreference)。ؓ(f)?jin)对W三个组q行逆向引用Q在模式中包括\3卛_。这会(x)只匹配一个与以前的组相匹配的严格重复的数据。ؓ(f)?jin)说明此问题Q考虑一个在文本文g中常见的错误—?一个句子中意外地重复出现某个常用的单词Q如“the”?#8220;of”?/p>
" The the water molecules are made of of hydrogen and oxygen."
下面~写一个模式来扑և文g中存在的q些问题。该模式捕L(fng)一个单词,后跟一些空白符Q而其后又跟着匚wW一个单词的重复模式Q?/p>
该模式匹配情况如下:(x)一个空白字W、特D的单词列表中的一个单词、更多的I白、再ơ重复的相同的单?使用\1逆向引用)以及(qing)I白W或标点W号。这U匹配应不区分大写Q以便能够捕获到“The the”以及(qing)cM的变型。如以下的代码段所C,该模式不区分大小写,能在一个字W串中查N复出现的模式Q?/p>
String data = getStringData();
String patternStr = "\\s(of|or|the|to)\\s+\\1[\\s\\ .,;]";
Pattern wordPattern =
Pattern.compile(patternStr, Pattern.CASE_INSENSITIVE);
Matcher wordMatcher = wordPattern.matcher(data);
while (wordMatcher.find()) {
int start = wordMatcher.start();
String word = wordMatcher.group(1);
// print the index location of the repeated word
System.out.println("Repeated " + word + " starting at " + start);
}
有一U简便和强大的匹配文件中文本的方法,该方法允怋用多个正则表辑ּ来处理文Ӟ本章后面?#8220;使用Scannerc进行语法分?#8221;一节将?x)讲解此?gu)。若想了(jin)解用内|烦(ch)引进行更为复杂的文本搜烦(ch)的解x法,请参考第3章中“使用Luceneq行搜烦(ch)”一节的内容?/p>
]]>2.3 在一个String中查扑֭串模?/title> http://www.aygfsteel.com/yydy1983/articles/245145.html♂游泳的?/dc:creator>♂游泳的?/author>Tue, 09 Dec 2008 01:29:00 GMT http://www.aygfsteel.com/yydy1983/articles/245145.html http://www.aygfsteel.com/yydy1983/comments/245145.html http://www.aygfsteel.com/yydy1983/articles/245145.html#Feedback 1 http://www.aygfsteel.com/yydy1983/comments/commentRss/245145.html http://www.aygfsteel.com/yydy1983/services/trackbacks/245145.html 2.3 在一个String中查扑֭串模?/strong>
本章前面?#8220;使用正则表达式来搜烦(ch)文本”一节说明了(jin)如何使用regex模式来比较一个String是否匚w(或部分匹?一个给定的模式。这里,匚w是从输入字符串的W一个字W开始的。在本节中,用regex模式在一个String中查扑֤个匹配倹{D例来_(d)可以在一文中搜烦(ch)查找嵌入在正文中的Q何URL。首先,需要创Z个匹配URL的模式字W串。下面给Z个能匚w大多数URL的模式:(x)
String urlString = "(http|https|ftp)://[/\\w\\.\\-\\+\\?%=&;:,#]+";
此模式ƈ不能有效地描qURLQ因为它也匹配一些包含错误语法的URL字符Ԍ?a href="http://////////">http://////////。在一些情况下它也?x)捕获额外的字符Q如可能紧跟在嵌入到正文中的URL之后的逗号或分受这些字W有时会(x)出现在URL中,但是如果URL出现在正文中Q这些字W可能不希望URL的一部分而被捕获。但该模式相对简短ƈ且能够很好地用于搜烦(ch)文本文g中包含的URL。此模式表达式的各部分如下所C:(x)
?nbsp; http、https或ftp
?nbsp; ://
?nbsp;/ 0-9 A-Z a-z _ . - + ? % = & ; : , #中的一个或多个字符
我们知道QMatcher可以一个模式应用到一个特D的输入字符丌Ӏؓ(f)?jin)用前面定义的urlString模式查找多个子串匚wQ必调用Matcher的findҎ(gu)。ؓ(f)?jin)在输入字符串内扑ֈ每一个出现的模式Q可以重复调用findҎ(gu)来查找下一个匹配。当没有更多的匹配时QfindҎ(gu)q回false。ؓ(f)?jin)获取当前匹配的位置Q可以用start和endҎ(gu)来获得烦(ch)引g在输入文本中的范围内q行匚w。以下的代码显C数据内扑ֈ的所有URLQ?/p>
String urlString = "(http|https|ftp)://[/\\w\\.\\-\\+\\?%=&;:,#]+";
Pattern urlPattern = Pattern.compile(urlString);
// get the data (somehow)
String data = getStringData();
// get a matcher for the data
Matcher urlMatcher = urlPattern.matcher(data);
// iterate through the matches
while (urlMatcher.find()) {
int startIndex = urlMatcher.start(); // index of start
int endIndex = urlMatcher.end(); // index of end + 1
// retrieve the matching substring
String currentMatch = data.substring(startIndex, endIndex);
System.out.println(currentMatch);
}
此代码将不能匚w相对的URL(?images/picture.jpg)Q这些URL常常出现在HTML文g或省略前|http://的不完整的URL(如wickedcooljava.com)中。ؓ(f)?jin)知道何时应该将某字W串作ؓ(f)相对URL来对待,E序必须理解HTML文g的结?使用regex也可完成此Q务,但是要更困难?。需要知道每个匹配的上下文,为此必须在理解其语法的基上分析文件。若想了(jin)解更多的信息Q请参考第3章?/p>
]]> 2.2 使用String.splitҎ(gu) http://www.aygfsteel.com/yydy1983/articles/244849.html♂游泳的?/dc:creator>♂游泳的?/author>Sun, 07 Dec 2008 04:07:00 GMT http://www.aygfsteel.com/yydy1983/articles/244849.html http://www.aygfsteel.com/yydy1983/comments/244849.html http://www.aygfsteel.com/yydy1983/articles/244849.html#Feedback 0 http://www.aygfsteel.com/yydy1983/comments/commentRss/244849.html http://www.aygfsteel.com/yydy1983/services/trackbacks/244849.html 2.2 使用String.splitҎ(gu)
开发h员有旉要用分隔符(如逗号、制表符或空?一个String分割成子丌Ӏ正如上一节中讨论的那PJava 1.4d?jin)Patterncȝ来和常规表达式来执行文本比较。除?jin)模式匹配外Q用常规表达式作为分隔符QPattern对象可以一个String分割成一个子串数l。例如,可以使用逗号作ؓ(f)模式一行以逗号分隔的列表划分成一个字W串数组Q?/p>
String data = "Australia,Fiji,New Zealand,Papua New Guinea";
Pattern comma = Pattern.compile(",");
String[] countries = comma.split(data);
分割字符串更单的实现Ҏ(gu)是:(x)使用StringcM的splitҎ(gu)。用此Ҏ(gu)重写以上代码。这一ơ将更改分隔W以包括逗号前后的所有空白,以它不成ؓ(f)子串值的一部分Q?
String data = "Australia, Fiji, New Zealand , Papua New Guinea";
String[] countries = data.split("\\s*,\\s *");
正如前面介绍q的Pattern对象那样Q在q里同样可以采用相同的正则表辑ּ语法。因此用splitҎ(gu)的场合远不止逗号和空根{?/p>
]]>
վ֩ģ壺
ƽԶ |
ͷ |
Ľ |
|
ͬ |
|
Ϊ |
|
|
ֹ |
ɽ |
|
̨ |
|
|
|
̳ |
ľ |
|
Ͻ |
|
|
ɽ |
|
|
|
ͬ |
Ϫ |
ͤ |
ͼ |
|
|
|
|
|
ľ |
|
|
|
˿ |
֦ |