Java Reference
In-Depth Information
public String replace(char oldChar, char newChar)
Returns a String with all instances of oldChar replaced with the
character newChar .
public String replace(CharSequence oldSeq, CharSquence newSeq)
Returns a String with each occurrence of the subsequence
oldSeq replaced by the subsequence newSeq .
public String trim()
Returns a String with leading and trailing whitespace stripped.
Whitespace characters are those identified as such by the
Character.isWhitespace method and include space, tab, and
newline.
A number of methods return related strings based on a match with
a given regular expressionsee " Regular Expression Matching " on page
321 :
public String replaceFirst(String regex, String repStr)
Returns a String with the first substring that matches the
regular expression regex replaced by repStr . Invoked on str ,
this
is
equivalent
to
Pat-
tern.compile(regex).matcher(str).replaceFirst(repStr) .
public String replaceAll(String regex, String repStr)
Returns a String with all substrings that match the regular
expression regex replaced by repStr . Invoked on str , this
is
equivalent
to
Pat-
tern.compile(regex).matcher(str).replaceAll(repStr) .
public String[] split(String regex)
 
Search WWH ::




Custom Search