I have a string variable with a value of “Manager 11Manager 11”.
string = Manager 11Manager 11
I wanted to get only the “Manager 11” value. How should I do it?
I tried using this formula but the output was incorrect:
String.Join(" ", text.Distinct())
Output: “M a n g e r 1”
Note that there are cases that it will only be “Manager 11” so it should stay as is. No need to trim it anymore. I am looking for a code that can be used for both scenarios.
Let’s say the text is “Manager 11”, even if I use the code, the output will still be “Manager 11” but if the text is “Manager 11Manager 11”, the output should also be “Manager 11”.