String.Replace Method

Definition

Overloads

Replace(ICharSequence, ICharSequence)

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

Replace(Char, Char)

Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.

Replace(String, String)

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

Replace(ICharSequence, ICharSequence)

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

[Android.Runtime.Register("replace", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;", "")]
public string Replace (Java.Lang.ICharSequence target, Java.Lang.ICharSequence replacement);
[<Android.Runtime.Register("replace", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;", "")>]
member this.Replace : Java.Lang.ICharSequence * Java.Lang.ICharSequence -> string

Parameters

target
ICharSequence

The sequence of char values to be replaced

replacement
ICharSequence

The replacement sequence of char values

Returns

String

The resulting string

Attributes

Exceptions

if target or replacement is null.

Remarks

Java documentation for java.lang.String.replace(java.lang.CharSequence, java.lang.CharSequence).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Replace(Char, Char)

Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.

[Android.Runtime.Register("replace", "(CC)Ljava/lang/String;", "")]
public string Replace (char oldChar, char newChar);
[<Android.Runtime.Register("replace", "(CC)Ljava/lang/String;", "")>]
member this.Replace : char * char -> string

Parameters

oldChar
Char

the old character.

newChar
Char

the new character.

Returns

String

a string derived from this string by replacing every occurrence of oldChar with newChar.

Attributes

Remarks

Java documentation for java.lang.String.replace(char, char).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Replace(String, String)

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.

public string Replace (string target, string replacement);
member this.Replace : string * string -> string

Parameters

target
String

The sequence of char values to be replaced

replacement
String

The replacement sequence of char values

Returns

String

The resulting string

Remarks

Java documentation for java.lang.String.replace(java.lang.CharSequence, java.lang.CharSequence).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to