If you use a 5 character string (hello) to call the Mid function and provide 0 for start, -1 for count, it'll give you the entire string. This should either return an assert or treat all negatives at a 0 to return nothing.
1. Create a new blank C++ project
2. Add a new C++ class based off Actor
3. In the .h file, on line 22, add the following lines:
FString a = "hello";
FString b = a.Mid(0, -1);
4. In the .cpp file, at line 20, add the following line:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, b);
5. In the same .cpp file, on line 5, add the following line:
#include "Engine.h"
6. Return to the editor and hit the Compile button
7. After the compilation is done, create a new blueprint of your new Actor class
8. Create an instance of this new blueprint by dragging it into the level
9. Press PIE
Result: "hello" is printed on the screen
Expected: The -1 for the count variable should result in this either displaying nothing or throwing an assert to let the user know that it should not be given a negative number.
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Fix Commit | 3090495 |
---|---|
Main Commit | 3126145 |
Created | Jul 16, 2015 |
---|---|
Resolved | Aug 16, 2016 |
Updated | Feb 5, 2017 |