RAD Studio |  |

Adding a String to a List
See Also
Collapse All

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:

Copy Code

    Insert(2, 'Three');

Copy Code

    StringList1->Insert(2, "Three");

To append the strings from one list onto another, call AddStrings:

Copy Code

    StringList1.AddStrings(StringList2);  { append the strings from StringList2 to StringList1 }

Copy Code

    StringList1->AddStrings(StringList2);  // append the strings from StringList2 to StringList1

See Also

Manipulating Strings in a List

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!