转义URL中字符
- URLEncoder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
class DemoApplicationTests {
void contextLoads() throws UnsupportedEncodingException {
System.out.println("*****************Start...");
String url = "http://localhost:8080/v1/leaders?name=";
String queryString = "?name=" + URLEncoder.encode("App & Prouducts", "UTF-8").replaceAll("\\+", "%20");
url += queryString
System.out.println("*****************newStr: " + url);
System.out.println("*****************End");
}
}
Google Cahce
1 | import java.util.concurrent.TimeUnit; |
正则表达
1 | import java.util.regex.Matcher; |
XPath解析RSS
1 | public class RssItem { |
v1.5.2