Hey Bradley,
I think, Gautham Prabhu K is right, there is no standard algorithm that solves your problem out of the box. But I don't think, this is impossible either. I would split this problem into 2 steps and then solve them in inverse order:
1. Understand the pattern
2. Build the room numbers
Solution for step 2 can be rather simple. For the series A100..A149 this could look like this:
const string pattern = "A{0}";
Collection<string> result = new Collection<string>();
for(int i = min; i < max; i++)
{
result.Add(string.Format(pattern, i);
}
For other patterns, you modify the pattern string. For more complex series (use only even numbers, increment letters, anything else) you have to adapt the string.Format calls. Not to complex instill now.
Solving step 1 is not that easy. Your program must read some user input and "understand" the intended pattern. Possible approaches:
1. As F-ES Sitecore suggested, one possibility is to make the user input explicit: A form where you can mark some input as constant and some as variable would be one example. Entering a format string or a reg-ex would be two others.
2. Or you write a program that Collect some example values and tries to understand them. I pick one of your examples: "B-100" and "B-120". For sure, "B-1" can be recognized as constant and "00"/"20" as variable. It can be some effort to extend this algorithm to more possible examples, but it is possible.
In the end, one criteria is, how much time you want to invest to solve this problem.
Hope this helps,
- KM