MaskedTextProvider.InsertAt Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Inserts a character or string at a specific position within the formatted string.
InsertAt(Char, Int32) |
Inserts the specified character at the specified position within the formatted string. |
InsertAt(String, Int32) |
Inserts the specified string at a specified position within the formatted string. |
InsertAt(Char, Int32, Int32, MaskedTextResultHint) |
Inserts the specified character at the specified position within the formatted string, returning the last insertion position and the status of the operation. |
InsertAt(String, Int32, Int32, MaskedTextResultHint) |
Inserts the specified string at a specified position within the formatted string, returning the last insertion position and the status of the operation. |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
Inserts the specified character at the specified position within the formatted string.
public:
bool InsertAt(char input, int position);
public bool InsertAt (char input, int position);
member this.InsertAt : char * int -> bool
Public Function InsertAt (input As Char, position As Integer) As Boolean
Parameters
- position
- Int32
The zero-based position in the formatted string to insert the character.
Returns
true
if the insertion was successful; otherwise, false
.
Remarks
The InsertAt method inserts a character into the first edit position at or beyond that specified by the pos
parameter. This method will shift all existing characters after the insertion point over by one position to make room for the inserted input
character. If one of the following errors occurs, the insertion is not performed, and the method returns false
.
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 insertion character,
input
, is not a valid input character because it is not printable or does not match its corresponding mask element.There are no available positions to the right of the insertion point, so that existing characters cannot be shifted.
Shifting the existing characters would produce a violation of the mask.
An empty input
string will cause no change in the formatted string, but will return true
.
See also
Applies to
.NET 9 dan versi lain
Produk | Versi |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
Inserts the specified string at a specified position within the formatted string.
public:
bool InsertAt(System::String ^ input, int position);
public bool InsertAt (string input, int position);
member this.InsertAt : string * int -> bool
Public Function InsertAt (input As String, position As Integer) As Boolean
Parameters
- position
- Int32
The zero-based position in the formatted string to insert the input string.
Returns
true
if the insertion was successful; otherwise, false
.
Exceptions
The input
parameter is null
.
Remarks
The InsertAt method inserts each character from the input
string into the edit positions located at position pos
and beyond. This method will shift all existing characters after the insertion point over by one position for each inserted character. If one of the following errors occurs, no insertion is performed, and the method returns false
.
The
pos
parameter is less than zero or greater than the Length of the formatted string.Not enough editable characters exist in the formatted string at or beyond the specified position,
pos
, to insert all of the characters from theinput
string.One or more of the insertion characters are not a valid input character because they are not printable or do not match their corresponding mask element.
There are not enough available positions to the right of the insertion point, so that existing characters cannot be shifted.
Shifting the existing characters would produce a violation of the mask. Note that this shifting occurs during the insertion of each individual character.
An empty input
string will cause no change in the formatted string, but will return true
.
See also
Applies to
.NET 9 dan versi lain
Produk | Versi |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
Inserts the specified character at the specified position within the formatted string, returning the last insertion position and the status of the operation.
public:
bool InsertAt(char input, int position, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool InsertAt (char input, int position, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.InsertAt : char * int * int * MaskedTextResultHint -> bool
Public Function InsertAt (input As Char, position As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean
Parameters
- position
- Int32
The zero-based position in the formatted string to insert the character.
- testPosition
- Int32
If the method is successful, the last position where a character was inserted; otherwise, the first position where the insertion failed. An output parameter.
- resultHint
- MaskedTextResultHint
A MaskedTextResultHint that succinctly describes the result of the insertion operation. An output parameter.
Returns
true
if the insertion was successful; otherwise, false
.
Remarks
The InsertAt method inserts a character into the first edit position at or beyond that specified by the pos
parameter. This method will shift all existing characters after the insertion point over by one position to make room for the inserted input
character. If one of the following errors occurs, the insertion is not performed, and the method returns false
.
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 insertion character,
input
, is not a valid input character because it is not printable or does not match its corresponding mask element.There are no available positions to the right of the insertion point, so that existing characters cannot be shifted.
Shifting the existing characters would produce a violation of the mask.
An empty input
string will cause no change in the formatted string, but will return true
.
See also
Applies to
.NET 9 dan versi lain
Produk | Versi |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
- Source:
- MaskedTextProvider.cs
Inserts the specified string at a specified position within the formatted string, returning the last insertion position and the status of the operation.
public:
bool InsertAt(System::String ^ input, int position, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool InsertAt (string input, int position, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.InsertAt : string * int * int * MaskedTextResultHint -> bool
Public Function InsertAt (input As String, position As Integer, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean
Parameters
- position
- Int32
The zero-based position in the formatted string to insert the input string.
- testPosition
- Int32
If the method is successful, the last position where a character was inserted; otherwise, the first position where the insertion failed. An output parameter.
- resultHint
- MaskedTextResultHint
A MaskedTextResultHint that succinctly describes the result of the insertion operation. An output parameter.
Returns
true
if the insertion was successful; otherwise, false
.
Exceptions
The input
parameter is null
.
Remarks
The InsertAt method inserts each character from the input
string into the edit positions located at position pos
and beyond. This method will shift all existing characters after the insertion point over by one position for each inserted character. If one of the following errors occurs, no insertion is performed, and the method returns false
.
The
pos
parameter is less than zero or greater than the Length of the formatted string.Not enough editable characters exist in the formatted string at or beyond the specified position,
pos
, to insert all of the characters from theinput
string.One or more of the insertion characters are not a valid input character because they are not printable or do not match their corresponding mask element.
There are not enough available positions to the right of the insertion point, so that existing characters cannot be shifted.
Shifting the existing characters would produce a violation of the mask. Note that this shifting occurs during the insertion of each individual character.
An empty input
string will cause no change in the formatted string, but will return true
.
See also
Applies to
.NET 9 dan versi lain
Produk | Versi |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET maklum balas
.NET ialah projek sumber terbuka. Pilih pautan untuk memberikan maklum balas: