Remove_if?

Hi pps; I’ve been looking around, but can’t be sure…
I’d like to know if there’s an UE4 equivalent to “remove_if” for Text operations ?!?

http://en.cppreference.com/w/cpp/algorithm/remove

I know that there’s FString->RemoveAt(), but that requires looping; Right now I’m converting to std::string instead to avoid going too deep in char* manipulations.

No. We’re encouraged not to use the std library. Here’s a related link that might help: How to use C++ Standard Library? (std) - Programming & Scripting - Epic Developer Community Forums

String related classes:

FString: FString | Unreal Engine Documentation

FText: FText | Unreal Engine Documentation

FName: FName | Unreal Engine Documentation

Implementing your own, and narrowing its use to strings makes it easier, seems like your best choice.

I know about when we can use std or not.
What I was asking is if there’s a method as simple as:

std::string S = TCHAR_TO_UTF8(*Title->ToString());
S.erase(std::remove_if(S.begin(),S.end(),isspace),S.end());

To remove white spaces from an FString without having to convert to std::string first. And there’s no problem converting to std in this case, it’s not a UProperty and compiles crossplatform, still I’d rather not have to use std at all.

He searching for equivalent :slight_smile:

You won’t find lambda arguments in UE4 (except of Slate), it’s pretty fresh C++ feature, but the reference version of that function can be substituted with Replace function i think

Replace space (or anything else) with nothing.

Thanks! Was just wanting to make sure I would not reinvent the wheel before messing with this.
This is exactly what I was looking for, just Replace by empty char =]

Just a note since somebody might get the wrong idea from your post. Lambda arguments are usable for a lot of container types (Array, Set, Map), just not FStrings.