Is there a way to manipulate a list where a hyphen is found using Linq? No other special characters should be altered, but new list items should be created:
The input list contains {Jack-Jones, Smith-Western}
The output list should show the hypen, reverse the given list item with the hypen, remove the hyphen, then split the string where the hypen was found:
The Output should look like:
{Jack-Jones, Jones-Jack, Jack Jones, Jones Jack,Jack, Jones, Smith-Western, Western-Smith, Smith Western, Western Smith, Smith, Western}
I’ve tried to use linq split, replace & orderby, but i’ve not had much success.
I have done the array manipulation by using split. I have stored the data in a array variable.
Use for each to iterate for every item. I splitted the current item by “-”(hyphen).
I took another array variable to store the structure that I need.
Same you can done with the lists. Find the below picture for the process steps.
Thank you for your message, but i’d prefer to do this without having to loop through the array. Is there a way that this can be achieved using linq? @Yoichi are you able to offer some guidance please?