Hey All,
I’m trying to sort / prioritize an array with substrings. I only care about whats after the “@” symbol… the domain. The array will always be of different sizes, order and may or may not contain of the domains I wan’t prioritized. See below as example
[‘usr1@[B]domx.com[B]domy.com[B]domz.com
So what if i want to it to look would be like below, always with x then y then z. z always last if it exists
[‘[B]domx.com[B]domy.com[B]domz.com
there may instances when x/y/z domains don’t exist. I don’t care about the order of any other domains
I’ve tried sort() with a compare function and i can always get domz.com as last element but can’t control anything after that
Appreciate some help