In my program, you can write a string where you can write variables.
For example:
The name of my dog is %x% and he has %y% years old.
The word where I can replace is any between %%. So I need to get a function where tells which variables I have in that string.
GetVariablesNames(string) => result { %x%, %y% }
I would use a Regular Expression to find anything that looks like a variable.
If your variables are percent-sign, any-word-character, percent-sign, then the following should work:
MSDN:
Regex.Matches