1、將com
.regex.test轉換成com/regex/test
用replaceAll轉換
replaceAll中的第一個參數是一個正則表達示,不是普通的字符串組合
replaceAll("
.", "/") <===>Pattern.compile("
.")
.matcher(str)
.replaceAll("/")
"."需加轉義符,要寫成"\\.",如replaceAll("\\
.", "/") 即可。
posted on 2006-08-21 10:02
阿成 閱讀(232)
評論(0) 編輯 收藏 所屬分類:
Java