Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Generating a alphanumeric values in series

I would like to generate a alphanumeric series in the fashion - AA0AAA00

The next would be AA0AAA01, AA0AAA02 ... AA0AAA99, AA0AAB00, AA0AAB01....AA0AAZ99, AA0ABA00 upto ZZ9ZZZ99

I have tried with

var start = "AA0AAA00"
var current = start
while (start != "ZZ9ZZZ99")
{
    current = current + 1
    console.log(current)
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here is a recursive generator solution. First it translates the pattern to ranges of "digits" for each position, and then the recursion iterates each character in the range for the first position and leaves the rest to the recursion.

For the example run I just took the pattern "A0" so to limit the size of the output here:

function* gen(start) {
    let ranges = Array.from(start, ch =>
        ch == "0" ? "0123456789" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    );
    
    function* recur(range, ...rest) {
        if (!rest.length) return yield* range;
        for (let ch of range) {
            for (let out of recur(...rest)) {
                yield ch + out;
            }
        }
    }
    
    yield* recur(...ranges);
}

console.log([...gen("A0")]);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!