转换号码的字母的组合 [英] convert number to combination of letters

查看:126
本文介绍了转换号码的字母的组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要1到600万之间的转换一些像ABCDE一个字母组合。 少信为好。但我猜我将需要4或5。

I need to convert a number between 1 and 6000000 to a letter combination like ABCDE. Less letters is better. but i'm guessing i will need 4 or 5.

有人能指出我朝着正确的方向如何写一个算法,数字转换成字母和回来?只有A-Z。 (上限)。

Can someone point me in the right direction as how to write an algorithm to convert numbers to letters and back? only A-Z. (caps).

推荐答案

您需要转换为基础-26编号:0是A,1 B,25为Z,26是BA等

You need to convert to base-26 numbering: 0 is A, 1 is B, 25 is Z, 26 is BA, etc.

借助 Hexavigesimal维基百科的文章有code转换为基础26。

The Hexavigesimal Wikipedia article has code for conversion to base 26.

这篇关于转换号码的字母的组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆