Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何用 %2b 替换 +,一些搜索以 + 作为空格,我无法在 java servlet 中执行
org.apache.commons.lang.StringEscapeUtils.replaceEach(str, new String[]{"+", "=", ...}, new String[]{"%2b", "%3D", ...})
利用java.net.URLEncoder
java.net.URLEncoder
例如:URLEncoder.encode( "one+two space", "UTF-8" )你会得到字符串one%2Btwo+space
URLEncoder.encode( "one+two space", "UTF-8" )
one%2Btwo+space