replaceAll

open fun replaceAll(template: CharSequence, sources: Array<String>, destinations: Array<CharSequence>): CharSequence

This method is based on Android's replace and extends its functionality by replacing all instances of each String specified in the sources parameter with the associated destination CharSequence. It is important to note that this exists for CharSequences (which are not necessarily Strings) that have android.text.Spanned portions and for which the relevant spans must be maintained. If we were to use replaceAll in cases such as these, the span information would be lost.

Return

the CharSequence with all replacements applied

Parameters

template

the CharSequence on which we should perform replacements

sources

an Array of Strings to find and replace in template

destinations

an Array of CharSequences corresponding to the sources strings which will serve as replacements

See also

android.text.TextUtils#replace(CharSequence, String[], CharSequence[])