Hi,
I have a requirement where I need to generate the combinations of string based on some rules.
For Eg: I have a string like: [x | y] z [A]
Possible combinations are,
z,ZA,xz,xyz,xzA,yzA
The rules are,
1.[],| are symbols.
2.Any text inside [] is optional
eg: [x]
3.| means “or”
eg:;[x | y] – this means either “x” or “y”. Both cannot come together.
4.Any text outside [] is mandatory
eg: z
5. <> Means range and can be ignored eg:
<1-512> The text suffix to this operator must be treated as any other combination.
Can we store these rules in somewhere in configuration file and create combinations for the string based on these rules.
Is that possible in c#4.0? Eg: IEnumerable and Enumerator interfaces will this help out?
The string may vary in different formats as
[navigation] (destination ((point | points) of interest | POI) | find a (point of interest | POI) | find points of interest)
The logic which am going to implement should work for all the strings, means if my logic works for one particular combination should not break for other.
please help me out with this stuff.