संपादित करें

इसके माध्यम से साझा किया गया


MaskedTextProvider.Replace Method

Definition

Replaces one or more editable characters in the formatted string with the specified characters.

Overloads

Replace(String, Int32, Int32, Int32, MaskedTextResultHint)

Replaces a range of editable characters between the specified starting and ending positions with the specified string, and then outputs the removal position and descriptive information.

Replace(Char, Int32, Int32, Int32, MaskedTextResultHint)

Replaces a single character between the specified starting and ending positions with the specified character value, and then outputs the removal position and descriptive information.

Replace(String, Int32, Int32, MaskedTextResultHint)

Replaces a range of editable characters starting at the specified position with the specified string, and then outputs the removal position and descriptive information.

Replace(Char, Int32, Int32, MaskedTextResultHint)

Replaces a single character at or beyond the specified position with the specified character value, and then outputs the removal position and descriptive information.

Replace(String, Int32)

Replaces a range of editable characters starting at the specified position with the specified string.

Replace(Char, Int32)

Replaces a single character at or beyond the specified position with the specified character value.

Replace(String, Int32, Int32, Int32, MaskedTextResultHint)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a range of editable characters between the specified starting and ending positions with the specified string, and then outputs the removal position and descriptive information.

public:
 bool Replace(System::String ^ input, int startPosition, int endPosition, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Replace (string input, int startPosition, int endPosition, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Replace : string * int * int * int * MaskedTextResultHint -> bool
Public Function Replace (input As String, startPosition As Integer, endPosition As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean

Parameters

input
String

The String value used to replace the existing editable characters.

startPosition
Int32

The zero-based position in the formatted string where the replacement starts.

endPosition
Int32

The zero-based position in the formatted string where the replacement ends.

testPosition
Int32

If successful, the zero-based position in the formatted string where the last character was actually replaced; otherwise, the first position where the operation failed. An output parameter.

resultHint
MaskedTextResultHint

A MaskedTextResultHint that succinctly describes the result of the replacement operation. An output parameter.

Returns

true if all the characters were successfully replaced; otherwise, false.

Remarks

The Replace method searches for the first editable position in the formatted string between the specified starting and ending positions. Operating on the assumption that there are enough editable positions after this point, the existing character values are replaced one-by-one with the contents of the replacement string parameter, input.

The following conditions are considered errors. When an error occurs, no replacement occurs and Replace returns false.

  • The startPos or endPos parameters point before the start of the formatted string or beyond its end.

  • There are not enough editable positions in the formatted string to hold the contents of the replacement string.

  • One of the replacement character values is not valid because it is not printable or does not match its corresponding mask element.

In addition to the return value, this method has two output parameters to supply additional information about the replacement operation.

See also

Applies to

Replace(Char, Int32, Int32, Int32, MaskedTextResultHint)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a single character between the specified starting and ending positions with the specified character value, and then outputs the removal position and descriptive information.

public:
 bool Replace(char input, int startPosition, int endPosition, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Replace (char input, int startPosition, int endPosition, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Replace : char * int * int * int * MaskedTextResultHint -> bool
Public Function Replace (input As Char, startPosition As Integer, endPosition As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean

Parameters

input
Char

The Char value that replaces the existing value.

startPosition
Int32

The zero-based position in the formatted string where the replacement starts.

endPosition
Int32

The zero-based position in the formatted string where the replacement ends.

testPosition
Int32

If successful, the zero-based position in the formatted string where the last character was actually replaced; otherwise, the first position where the operation failed. An output parameter.

resultHint
MaskedTextResultHint

A MaskedTextResultHint that succinctly describes the result of the replacement operation. An output parameter.

Returns

true if the character was successfully replaced; otherwise, false.

Remarks

The Replace(Char, Int32, Int32, Int32, MaskedTextResultHint) method searches for the first editable position in the formatted string between the specified starting and ending positions. If one is found, the value of the editable position is changed to the specified character, input. Any of the following conditions will result in an error condition that causes no replacement to be performed and a value of false to be returned:

  • The startPos or endPos parameters point before the start of the formatted string or beyond its end.

  • An editable character was not found in the specified interval.

  • The replacement character, input, is not a valid input character because it is not printable or does not match its corresponding mask element.

In addition to the return value, this method has two output parameters to supply additional information about the replacement operation.

See also

Applies to

Replace(String, Int32, Int32, MaskedTextResultHint)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a range of editable characters starting at the specified position with the specified string, and then outputs the removal position and descriptive information.

public:
 bool Replace(System::String ^ input, int position, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Replace (string input, int position, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Replace : string * int * int * MaskedTextResultHint -> bool
Public Function Replace (input As String, position As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean

Parameters

input
String

The String value used to replace the existing editable characters.

position
Int32

The zero-based position to search for the first editable character to replace.

testPosition
Int32

If successful, the zero-based position in the formatted string where the last character was actually replaced; otherwise, the first position where the operation failed. An output parameter.

resultHint
MaskedTextResultHint

A MaskedTextResultHint that succinctly describes the result of the replacement operation. An output parameter.

Returns

true if all the characters were successfully replaced; otherwise, false.

Remarks

The Replace(String, Int32, Int32, MaskedTextResultHint) method searches for the first editable position at or beyond the specified position, pos. Operating on the assumption that there are enough editable positions after this point, the existing character values are replaced one-by-one with the contents of the replacement string parameter, input.

The following conditions are considered errors. When an error occurs, no replacement occurs and Replace(String, Int32, Int32, MaskedTextResultHint) returns false.

  • The pos parameter is less than zero or greater than the Length of the formatted string.

  • There are not enough editable positions in the formatted string to hold the contents of the replacement string.

  • One of the replacement character values is not valid because it is not printable or does not match its corresponding mask element.

In addition to the return value, this method has two output parameters to supply additional information about the replacement operation.

See also

Applies to

Replace(Char, Int32, Int32, MaskedTextResultHint)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a single character at or beyond the specified position with the specified character value, and then outputs the removal position and descriptive information.

public:
 bool Replace(char input, int position, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Replace (char input, int position, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Replace : char * int * int * MaskedTextResultHint -> bool
Public Function Replace (input As Char, position As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean

Parameters

input
Char

The Char value that replaces the existing value.

position
Int32

The zero-based position to search for the first editable character to replace.

testPosition
Int32

If successful, the zero-based position in the formatted string where the last character was actually replaced; otherwise, the first position where the operation failed. An output parameter.

resultHint
MaskedTextResultHint

A MaskedTextResultHint that succinctly describes the result of the replacement operation. An output parameter.

Returns

true if the character was successfully replaced; otherwise, false.

Remarks

The Replace(Char, Int32, Int32, MaskedTextResultHint) method searches for the first editable position in the formatted string at or beyond the specified position, pos. If one is found, the value of the editable position is changed to the specified character, input. Any of the following conditions will result in an error condition that causes no replacement to be performed and a value of false to be returned:

  • The pos parameter is less than zero or greater than the Length of the formatted string.

  • An editable character was not found in the formatted string at or beyond the specified position, pos.

  • The replacement character, input, is not a valid input character because it is not printable or does not match its corresponding mask element.

In addition to the return value, this method has two output parameters to supply additional information about the replacement operation.

See also

Applies to

Replace(String, Int32)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a range of editable characters starting at the specified position with the specified string.

public:
 bool Replace(System::String ^ input, int position);
public bool Replace (string input, int position);
member this.Replace : string * int -> bool
Public Function Replace (input As String, position As Integer) As Boolean

Parameters

input
String

The String value used to replace the existing editable characters.

position
Int32

The zero-based position to search for the first editable character to replace.

Returns

true if all the characters were successfully replaced; otherwise, false.

Exceptions

The input parameter is null.

Remarks

The Replace(String, Int32) method searches for the first editable position at or beyond the specified position, pos. Operating under the assumption that there are enough editable positions after this point, the existing character values are replaced one-by-one with the contents of the replacement string parameter, input.

The following conditions are considered errors. When an error occurs, no replacement occurs and Replace(String, Int32) returns false.

  • The pos parameter is less than zero or greater than the Length of the formatted string.

  • There are not enough editable positions in the formatted string to hold the contents of the replacement string.

  • One of the replacement character values is not valid because it is not printable or does not match its corresponding mask element.

See also

Applies to

Replace(Char, Int32)

Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs
Source:
MaskedTextProvider.cs

Replaces a single character at or beyond the specified position with the specified character value.

public:
 bool Replace(char input, int position);
public bool Replace (char input, int position);
member this.Replace : char * int -> bool
Public Function Replace (input As Char, position As Integer) As Boolean

Parameters

input
Char

The Char value that replaces the existing value.

position
Int32

The zero-based position to search for the first editable character to replace.

Returns

true if the character was successfully replaced; otherwise, false.

Remarks

The Replace(Char, Int32) method searches for the first editable position in the formatted string at or beyond the specified position, pos. If one is found, the value of the editable position is changed to the specified character, input. Any of the following conditions will result in an error that causes no replacement to be performed and a value of false to be returned:

  • The pos parameter is less than zero or greater than the Length of the formatted string.

  • An editable character was not found in the formatted string at or beyond the specified position, pos.

  • The replacement character, input, is not a valid input character because it is not printable or does not match its corresponding mask element.

See also

Applies to