how can I search a TArray for an FString?

I’ve got a TArray that contains integers. I need to iterate over this array and search each indice for the iterator variable “i”. With each loop “i” would increase and I need to convert that variable to text to work in the FString.Find() function.

This is how it looks right now.

for (int i = 0; i < NumberOfTriangles; i++)
		FString loopIndex = FString::FromInt(i);
		FText loopIndxTxt = FText::FromString(loopIndex);

I found that I can place a format indicator inside of the quotation marks like so:

FString edgeA;
int Index = FaceIds.Find(TEXT("%s"), edgeA);

Unfortunately I think that spot is reserved for the integer for the index of where the search finds the text in question. Is there a way around this?

Can you copy and paste your code so I can better see what you’re trying to do? I don’t understand why you need a string representation of the index value of the TArray. You’re basically correct on the rest though.

int foundIndex = 0;
for (int i = 0; i < NumberOfTriangles; ++i)
 if (FaceIds.Find(i, foundIndex))
   // We found the index where our value "i" is. 
   // Do whatever else.

int Index;
FString edgeA;
FString edgeB;
FString edgeC;

edgeA += " ";
edgeA += edgeB;
edgeB += " ";
edgeB += edgeC;
edgeC += " ";
edgeC += edgeA;

Index = listOfFaces.Find(TEXT(edgeA));
cell.neighborA = Index;
Index = listOfFaces.Find(TEXT(edgeB));
cell.neighborB = Index;
Index = listOfFaces.Find(TEXT(edgeC));
cell.neighborC = Index;

Unfortunately the above code doesn’t work. I get an “undeclared identifier” error. I also can’t do this:

Index = listOfFaces.Find(TEXT("%s"), edgeA);

Because in the spot where edgeA is, the find function is looking for an integer to update with the index where the text is found.

ahh, I didn’t notice what you did there. I needed to remove the TEXT part and just put the FString inside of the braces.

Index = listOfFaces.Find(edgeA);

What is listOfFaces? I was under the assumption it was a TArray. Can you post it’s declaration?