Java String replaceAll


The java string replaceAll() method returns a string replacing all the sequence of characters matching regex and replacement string.


Signature

public String replaceAll(String regex, String replacement)


Parameters

regex : regular expression

replacement :replacement sequence of characters


Returns

replaced string


Java String replaceAll() example: replace character

Let's see an example to replace all the occurrences of a single character.

Flash soon



Java String replaceAll() example: replace word

Let's see an example to replace all the occurrences of a single word or set of words.

Flash soon



Java String replaceAll() example: remove white spaces

Let's see an example to replace all the occurrences of a white space

Flash soon



Java String replace(CharSequence target, CharSequence replacement) method example

Flash soon



Copyright 2017 Design& Development