[Overview][Types][Classes][Index] |
Inserts the line of text in S at the specified position.
Source position: textstrings.pas line 83
public procedure TTextStrings.Insert( |
Index: Integer; |
const S: string |
); override; |
Index |
|
Ordinal position where the line of text is inserted. |
S |
|
Value for the line of text inserted in the method. |
Insert is an overridden method used to insert the line of text in S at the position specified in Index.
Index contains the ordinal position in Strings where the line of text is inserted. Index must be in the range 0..Count-1 or an EListError exception is raised.
S contains the line of text inserted in the method. S can contain an end-of-line sequence, but it is not required. The LineEnding for the platform is appended to the value in S if it is not already present.
Insert calls BuildArrays to populate the array of TTextLineRange instances when the internal validity flag is not set. It also ensures that the internal array is re-allocated when the number of lines reaches the line capacity. Line capacity starts at eight (8), and doubles each time the capacity is filled.
Memory allocated for the TTextLineRange instances is shifted when Index is not the last line of text in the component. The text in S, and the start and end positions in Text are stored in the line range information. The range information for lines after Index is adjusted to reflect the length of the inserted text.
Insert re-implements the method defined in the ancestor, and does not call the inherited method.
Use Add or AddStrings to append one or more lines of text to the values in Strings.
Raises an EListError exception if Index contains an invalild position in the list of string values.
Version 4.0 | Generated 2025-05-03 | Home |