String.Replace String.Replace Method

Definition

Overloads

Replace(String, String) Replace(String, String)
Replace(Char, Char) Replace(Char, Char)

Returns a copy of this string after replacing occurrences of the given char with another.

Replace(ICharSequence, ICharSequence) Replace(ICharSequence, ICharSequence)

Returns a copy of this string after replacing occurrences of target replaced with replacement.

Replace(String, String) Replace(String, String)

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

Parameters

target
String String
replacement
String String

Returns

Remarks

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.

Replace(Char, Char) Replace(Char, Char)

Returns a copy of this string after replacing occurrences of the given char with another.

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

Parameters

oldChar
Char Char

the character to replace.

newChar
Char Char

the replacement character.

Returns

Remarks

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.

Replace(ICharSequence, ICharSequence) Replace(ICharSequence, ICharSequence)

Returns a copy of this string after replacing occurrences of target replaced with replacement.

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

Parameters

target
ICharSequence ICharSequence

the sequence to replace.

replacement
ICharSequence ICharSequence

the replacement sequence.

Returns

Exceptions

if target or replacement is null.

Remarks

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