MaskedTextProvider::Replace Method (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.
Assembly: System (in System.dll)
public: bool Replace( String^ input, int startPosition, int endPosition, [OutAttribute] int% testPosition, [OutAttribute] MaskedTextResultHint% resultHint )
Parameters
- input
-
Type:
System::String^
The String value used to replace the existing editable characters.
- startPosition
-
Type:
System::Int32
The zero-based position in the formatted string where the replacement starts.
- endPosition
-
Type:
System::Int32
The zero-based position in the formatted string where the replacement ends.
- testPosition
-
Type:
System::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
-
Type:
System.ComponentModel::MaskedTextResultHint%
A MaskedTextResultHint that succinctly describes the result of the replacement operation. An output parameter.
Return Value
Type: System::Booleantrue if all the characters were successfully replaced; otherwise, false.
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.
Available since 2.0