Show: Delphi
C++
Display Preferences
Adding a String to a List
From RAD Studio
Go Up to Working with String Lists
To add a string to the end of a string list, call the Add method, passing the new string as the parameter. To insert a string into the list, call the Insert method, passing two parameters: the string and the index of the position where you want it placed. For example, to make the string "Three" the third string in a list, you would use:
Insert(2, 'Three');
StringList1->Insert(2, "Three");
To append the strings from one list onto another, call AddStrings:
StringList1.AddStrings(StringList2); { append the strings from StringList2 to StringList1 }
StringList1->AddStrings(StringList2); // append the strings from StringList2 to StringList1