Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8556075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:15:50+00:00 2026-06-11T15:15:50+00:00

Does anyone know of a Javascript library (e.g. underscore, jQuery, MooTools, etc.) that offers

  • 0

Does anyone know of a Javascript library (e.g. underscore, jQuery, MooTools, etc.) that offers a method of incrementing a letter?

I would like to be able to do something like:

"a"++; // would return "b"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:15:51+00:00Added an answer on June 11, 2026 at 3:15 pm

    Simple, direct solution

    function nextChar(c) {
        return String.fromCharCode(c.charCodeAt(0) + 1);
    }
    nextChar('a');
    

    As others have noted, the drawback is it may not handle cases like the letter ‘z’ as expected. But it depends on what you want out of it. The solution above will return ‘{‘ for the character after ‘z’, and this is the character after ‘z’ in ASCII, so it could be the result you’re looking for depending on what your use case is.


    Unique string generator

    (Updated 2019/05/09)

    Since this answer has received so much visibility I’ve decided to expand it a bit beyond the scope of the original question to potentially help people who are stumbling on this from Google.

    I find that what I often want is something that will generate sequential, unique strings in a certain character set (such as only using letters), so I’ve updated this answer to include a class that will do that here:

    class StringIdGenerator {
      constructor(chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
        this._chars = chars;
        this._nextId = [0];
      }
    
      next() {
        const r = [];
        for (const char of this._nextId) {
          r.unshift(this._chars[char]);
        }
        this._increment();
        return r.join('');
      }
    
      _increment() {
        for (let i = 0; i < this._nextId.length; i++) {
          const val = ++this._nextId[i];
          if (val >= this._chars.length) {
            this._nextId[i] = 0;
          } else {
            return;
          }
        }
        this._nextId.push(0);
      }
    
      *[Symbol.iterator]() {
        while (true) {
          yield this.next();
        }
      }
    }
    

    Usage:

    const ids = new StringIdGenerator();
    
    ids.next(); // 'a'
    ids.next(); // 'b'
    ids.next(); // 'c'
    
    // ...
    ids.next(); // 'z'
    ids.next(); // 'A'
    ids.next(); // 'B'
    
    // ...
    ids.next(); // 'Z'
    ids.next(); // 'aa'
    ids.next(); // 'ab'
    ids.next(); // 'ac'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know if there is a common javascript library to enable scrolling that
Does anyone know of a good javascript DOM ready library that I can use
Does anyone know of a JavaScript library that accurately implements the IEEE 754 specification
Does anyone know of a Calculus library for JavaScript? I've done some Googling and
Well does anyone know of a javascript that detects whether a user is using
Does anyone know of a JavaScript library for rendering form elements? For example for
Does anyone know of a DOM inspector javascript library or plugin? I want to
Does anyone know any way that I can use javascript to check when the
Does anyone know if there is any language detection script/library available for javascript? I
Does anyone know of a good javascript menu using the prototype library. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.