1.5支持替换CharSequence ============= replace public String replace(CharSequence target, CharSequence replacement)Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab". Parameters: target - The sequence of char values to be replaced replacement - The replacement sequence of char values Returns: The resulting string Throws: NullPointerException - if target or replacement is null. Since: 1.5
表示的是start的位置,结束位置默认为字符串的末尾
而不是楼上一位老兄说的起始位置为0
=============
replace
public String replace(CharSequence target,
CharSequence replacement)Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab". Parameters:
target - The sequence of char values to be replaced
replacement - The replacement sequence of char values
Returns:
The resulting string
Throws:
NullPointerException - if target or replacement is null.
Since:
1.5