0

Lets suppose I have the following strings:

string start = "ABC";
string end = "EEE";

I want to generate a collection of strings between those two, as if the characters were numbers, each one from A to Z. They will always have three characters. For example:

ABD
ABE
ABF
....// many strings, lets jump ahead
ABZ
ACA
....
AZZ
BAA
...
EEB
EEC
EED

I am trying to create a method like this:

public static IEnumerable<string> GenerateSequence(string start, string end)
{
    // while? for? do while?
    yield return ?;
}

But I really do not know where to begin. Am I reinventing the wheel? Is there a good algorithm to do this?

Guilherme
  • 5,143
  • 5
  • 39
  • 60

0 Answers0