62,615
社区成员
发帖
与我相关
我的任务
分享
List<String> list = new ArrayList<String>();
list.add("abc");
list.add("bca");
list.add("afdsf");
list.add("adcb");
list.add("bdca");
Map<String, String> map = new HashMap<String, String>();
System.out.println(list);
for (int i = 0; i < list.size(); ) {
String str = list.get(i);
char[] charArr = str.toCharArray();
Arrays.sort(charArr);
String newString = new String(charArr);
if (map.containsKey(newString)) {
list.remove(i);
} else {
map.put(newString, str);
i++;
}
}
System.out.println(list);
Pattern pattern = Pattern.compile("<\\w+>");
Pattern pattern2 = Pattern.compile("</\\w+>");
String text = "<h1>fsafs </h1><div> test</div>";
Matcher matcher = pattern.matcher(text);
text = matcher.replaceAll("");
matcher = pattern2.matcher(text);
text = matcher.replaceAll("");
System.out.println(text);
<html>
<head>
<title>test</title>
<style type="text/css">
#container {
position:relative;
width:90%;
background-color:#999900;
}
#navi {
position:relative;
width:20%;
background-color:#009999;
float:left;
height:120px;
}
#middle {
position:relative;
width:60%;
float:left;
background-color:#666666;
height:120px;
}
#side {
position:relative;
background-color:#999999;
float:right;
height:120;
}
</style>
<script type="text/javascript">
function addTable(){
var div = document.getElementById("middle");
var table = document.createElement("table");
var tbody = document.createElement("tbody");
var tr = document.createElement("tr");
var td = document.createElement("td");
table.border = 1;
td.innerHTML = "add by dom";
div.appendChild(table);
table.appendChild(tbody);
tbody.appendChild(tr);
tr.appendChild(td);
}
window.onload = addTable;
</script>
</head>
<body>
<div id="container">
<div id="navi">
sample text
</div>
<div id="middle">
content text
</div>
<div id="side">
</div>
</div>
</body>
</html>
select count(*) From (select id From tb1 As a union tb1 as b )