UE4 FString.FindChar doesnt function as stated
UE4F String.FindChar('a', i); In the describtion of the above function i which is an int32 will ahve its value replaced by the position of the char in case the char is found , if not the value will not change.
The bug is that if the char is not found , the value do change to -1 and this is because the implementation of the function is as follows:
Where Data.Find is implemented as :
Where we can see that the Index equals the Find(Item) that can equal(incase not found) to INDEX_NONE which is a define of value -1 , this was tested and its true that i is replaced with -1 where it value should remain unchanged if the function returns false.
I've fixed the FindChar comment, and also in FindLastChar. Thanks for reporting it!
That fix can be found along with other changes here:
answered Jul 03 '15 at 11:07 AM
Steve Robb STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here