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

131
Views
Generando valores alfanuméricos en serie

Me gustaría generar una serie alfanumérica a la moda - AA0AAA00

Los siguientes serían AA0AAA01, AA0AAA02...AA0AAA99, AA0AAB00, AA0AAB01....AA0AAZ99, AA0ABA00 hasta ZZ9ZZZ99

he probado con

 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

Aquí hay una solución de generador recursivo. Primero traduce el patrón a rangos de "dígitos" para cada posición, y luego la recursión itera cada carácter en el rango de la primera posición y deja el resto a la recursión.

Para la ejecución del ejemplo, simplemente tomé el patrón "A0" para limitar el tamaño de la salida aquí:

 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!