Hi,
Could you please provide a sorting function for arrays in blueprints?
Hi,
Could you please provide a sorting function for arrays in blueprints?
That’s a very broad need. Do you want to sort an array of text or strings? Do you want to sort Actors? Do you want to sort widgets? A sort array function for just text or strings is easy to do, but sorting other objects requires work very specific to the use case. You’re gonna have to create a function that not only returns the same type of object array that you’re passing in (not really something blueprints can do automatically) and you’ll need to specify what property exactly you want to sort by using predicates. It’s not impossible for Epic to do something like that but it’s pretty easy to do on your own. I’ve rambled enough, what are you trying to sort?
Hi. And how to sort strings or text alphabetically/alphanumerically?
Pick your sorting algorythm of choice and compare the strings… For small lists, even bubble sort is good enough.
A bigger obstacle might be that it doesnt quite work with nested arrays though…