x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

 FORCEINLINE bool FindChar( TCHAR InChar, int32& Index ) const
 {
     return Data.Find(InChar, Index);
 }

Where Data.Find is implemented as :

 FORCEINLINE bool Find(const ElementType& Item, int32& Index) const
     {
         Index = this->Find(Item);
         return Index != INDEX_NONE;
     }


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.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 03 '15 at 01:53 AM in Bug Reports

avatar image

TheTrice
112 22 21 28

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi,

I've fixed the FindChar comment, and also in FindLastChar. Thanks for reporting it!

That fix can be found along with other changes here:

https://github.com/EpicGames/UnrealEngine/commit/5db2bff2faaeb4dee8bf64263566cbaf4aa8333a

Steve

more ▼

answered Jul 03 '15 at 11:07 AM

avatar image

Steve Robb STAFF
2.7k 58 25 99

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question