来自维基百科的任何页面:
...
abas asdn asf asfs af
{{Template1
|a = Name surname
|b = jhsdf sdf
|c = {{Template2}}
|d =
|e = [[f]] and [[g]]
|h = asd asdasfgasgasg asgas jygh trdx dftf xcth
|i = 73
|j = {{Template2|abc|123}}
|j = {{Template3|aa=kkk|bb={{Template4|cc=uu}}}}
}}
asd wetd gdsgwew g
{{OtherTemplate
|sdf = 213
}}
...
Run Code Online (Sandbox Code Playgroud)
如何使用Java正则表达式找到Template1内容(start is |aend is }})?
我试过了:
String pattern = "\\{\\{\\s*Template1\\s*(.*?)\\}\\}";
Pattern p = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL); …Run Code Online (Sandbox Code Playgroud) 例如:
google.com/en/game/game1.html
应该是
google.com/index.php?p1=en&p2=game&p3=game1.html
如何拆分网址并发送index.php"/"的一部分?
我有一个功能:
Thread myThread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(500);
myThread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
呼叫呼叫Thread.sleep(500);是一样的myThread.sleep(500);吗?
两个不同的电话之间有什么不同吗?
例如:
public class Box{
public int id;
public Box(int id){
this.id = id;
}
}
ArrayList<Box> boxArray = new ArrayList<Box>();
boxArray.add(new Box(0));
boxArray.add(new Box(1));
boxArray.add(new Box(2));
for (Iterator<Box> iter = boxArray.iterator(); iter.hasNext();) {
Box box = iter.next();
if (box.id == 1) {
iter.remove();
box = null;
}
}
Run Code Online (Sandbox Code Playgroud)
我知道:在Java中,当没有referance时,JM是删除对象.
但