Maybe I misunderstood the title, sorry.
I have a string;
This is a test string. It was opened on %Date% for the customer named
%Customer%.
Here I want to be able to get a string containing "Date" and "Customer" with a method. How do I get the parts between the special characters "%" as strings?
Divider character and string can change dynamically. Thanks in advance.
>Solution :
You could extract it with System.Text.RegularExpressions.RexEx()
%[^%]*%" – starts with %, ends with % but doesn’t contain it [^%]*
string str = "This is a test string. It was opened on %Date% for the customer named %Customer%.";
string[] res = Regex.Matches(str, "%[^%]*%").Cast<Match>().Select(x => x.Value.Trim('%')).ToArray();