troubleshooting Question

What is a good method for incrementing a string sequence from "A" to "ZZZZ" in C# or vb.Net?

Avatar of jxbma
jxbmaFlag for United States of America asked on
C#Visual Basic.NETJavaScriptjQueryAlgorithms
17 Comments2 Solutions1553 ViewsLast Modified:
Hi:

I have an interesting problem I need to solve.
I'm sure that someone has encountered this somewhere
and that an elegant solution exists.

I'm trying to write an method which increments and returns the next
alphanumeric character in a sequence.

These letters are intended to range from 'A' to 'ZZZZ'.
I am only dealing with capital (uppercase letters)

Consider the following examples:

    INPUT        OUTPUT
    ===================
    A            B
    G            H
    Z            AA
    AZ          BA
    AZZZ      BAAA

I'm looking for a solution which is more or less portable across
languages (C#, VB.Net, JavaScript/JQuery). This of course rules out
trying something with LINQ.

I've made several attempts at this, but the all are kind of klunky.
Any thoughts, ideas, suggestions or directions to explore would be greatly appreciated.

Thanks,
JohnB
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros