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

  • SEARCH
  • Home
  • 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 6571119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:50:28+00:00 2026-05-25T14:50:28+00:00

I need to a function to convert an integer to the equivalent alpha ordered

  • 0

I need to a function to convert an integer to the equivalent alpha ordered list index. For example:

1 = a
2 = b
.
.
.
26 = z
27 = aa
28 = ab
.
.
etc.

Currently I have the following which almost works but there’s a small logic error somewhere that makes it not quite get it right (it goes ax, ay, bz, ba, bb, bc…):

function intToAlpha( int ) {

    var asciiStart = 97,
        alphaMax = 26,
        asciiCode,
        char,
        alpha = '',
        place,
        num,
        i;

    for ( i = 0; Math.pow(alphaMax, i) < int; i++ ) {

        place = Math.pow(alphaMax, i);        
        num = Math.floor( ( int / place ) % alphaMax);
        asciiCode = ( num == 0 ? alphaMax : num ) + asciiStart - 1;
        char = String.fromCharCode(asciiCode);
        alpha = char + alpha;

    }

    return alpha;
}

for (i = 1; i < 300; i++) {
    console.log( i + ': ' + intToAlpha(i) );
}
  • 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-05-25T14:50:29+00:00Added an answer on May 25, 2026 at 2:50 pm

    This function is used in NVu/Kompozer/SeaMonkey Composer, with a small tweak to generate lower case directly:

    function ConvertArabicToLetters(num)
    {
      var letters = "";
      while (num > 0) {
        num--;
        letters = String.fromCharCode(97 + (num % 26)) + letters;
        num = Math.floor(num / 26);
      }
      return letters;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in Java which I need to convert into php. It
I need a function that will convert a type to a string, for example:
i have time in a format of an integer example:(454 seconds) and i need
I have one function in oracle i need to convert it into c# code
I need to convert a Word document into HTML file(s) in Java. The function
I need a function that I can call when somthing is done, for example
I need a simple function which will take a FileInfo and a destination_directory_name as
I need to build a function which parses the domain from a URL. So,
I have a hexadecimal value, 07A5953EE7592CE8871EE287F9C0A5FBC2BB43695589D95E76A4A9D37019C8 Which I want to convert to a byte
I want to convert an integer into its character equivalent based on the alphabet.

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.