Hola Eduardo, ¿Cuál es el objetivo de evaluar si una lista está dentro de otra? ¿Necesariamente ha de ser TStringList?
La clase TList tiene un método con un comportamiento muy interesante que al menos yo le desconozco algo parecido a la clase base TStrings: Assing.
El método para TList tiene un parámetro que le permite indicar que operación posible se ha de llevar entre la lista A y la lista B que se quiere asignar. La ayuda dice:
Copies elements of one list to another.
procedure Assign(ListA: TList; AOperator: TListAssignOp = laCopy; ListB: TList = nil);
Description
Call Assign to assign the elements of another list to this one. Assign combines the source list with this one using the logical operator specified by the AOperator parameter.
If the ListB parameter is specified, then Assign first replaces all the elements of this list with those in ListA, and then merges ListB into this list using the operator specified by AOperator.
If the ListB parameter is not specified, then Assign merges ListA into this list using the operator specified by AOperator.
Y los operandos posibles son:
Indicates how two lists should be merged.
Unit
Classes
type TListAssignOp = (laCopy, laAnd, laOr, laXor, laSrcUnique, laDestUnique);
Description
TListAssignOps describes how the Assign method combines a source and destination list:
Value Meaning
laAnd Removes all elements from the destination list that do not appear in the source list. The destination list ends up containing the intersection of the two lists.
laCopy Overwrites the destination list with the source list.
laDestUnique Removes all elements from the destination list that appear in the source list. The destination list ends up containing the elements unique to the original destination list. (same as laOr followed by laXor)
laOr Adds any elements from the source list that do not already appear in the destination list. The destination list ends up containing the union of the two lists.
laSrcUnique Replaces the destination list with those elements of the source list that do not appear in the destination list. (same as laAnd followed by laXor)
laXor Removes all elements from the destination list that appear in the source list and adds any elements from the source list that do not appear in the original destination list. The destination list ends up with the elements unique to both the source and destination lists.
Si es entre las operaciones que tu buscas entre ambas listas encuentras lo que necesitas y si no necesariamente se ha de llevar a cabo con la clase TStringList podrías considerar el uso de List y una clase que encapsule los datos a la lista, un TMiItem por darle un nombre.
Sino no tendrás otra que implementar tu propio algoritmo que recorra al TStringList como lo estás encarando.
Por otro lado, mientras estuve investigando dentro de la VCL me doy con que la unidad Classes tiene entre sus funciones una que se llama NameInStrings. Básicamente lo que hace es recorrer al TStrings buscando un Name dentro de éste. Como tu necesitarías buscar los elementos de una lista en otra necesitarías algo como:
Hay := true; i := 0;
repeat
Hay := NameInStrings(ListaB, ListaA[i]);
i := i + 1;
until (NOT Hay) or (i = ListaA.Count);
if Hay
then ShowMessage('Efectivamente A está en B')
else ShowMessage('Lamentablemente al menos un elemento de A no está en B');
No estaría mal un método Assing() con el poder que tiene TList para la clase TStrings y sus descendientes. Al menos es lo que yo puedo hablar sobre D6... quizá para versiones más nuevas tenga más cosas (no sería de extrañar).
Saludos,