This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术 / Integer to String 的转换有一个整数, 是从数据库的Sequence来的想把它转换成String, 格式要求是:Z0Z0Z0, 就是第1,3,5 位是字母,2,4,6位是0-9的数字, 应该怎样实现? 有API或代码吗? Java最好.
1。 0 对应 A0A0A0
2。 1 对应 A0A0A1
3。 10 对应 A0A0B0
4。 11 对应 A0A0B1
-sxffff(lookingforjob);
2016-1-8
{234}
(#9865962@0)
-
java code
-mustang(mustang);
2016-2-8
{58}
(#9934694@0)
+1
-
非常感谢。但好像有bug。
i=295 A0A2J5
i=296 A0A2J6
i=297 A0A2J7
i=298 A0A2J8
i=299 A0A2J9
i=300 A0A3A0
i=301 A0A3A1
i=302 A0A3A2
i=303 A0A3A3
300 应该是A0A2K0
-sxffff(lookingforjob);
2016-2-10
{159}
(#9938562@0)
-
Are you sure? My code gets Decimal 300: A0A1E0. because 300 = (1 * 26 + 4) * 10 + 0
-benbenli(大岭);
2016-2-11
(#9938988@0)
+1
-
写了个验证,300=A0A1E0;
-sxffff(lookingforjob);
2016-2-13
{1333}
(#9942852@0)
+1
-
it might come from the way to split integer into digits, i will take a peek ,,,
-mustang(大叔);
2016-2-11
(#9939632@0)
-
个位、百位和万位十进制,十位、千位和十万位26进制吗?或者全部十进制?允许超过6位数吗?
-benbenli(大岭);
2016-2-10
(#9938225@0)
-
个位、百位和万位十进制,十位、千位和十万位26进制吗?对
允许超过6位数吗?输入可以, 输出不可以。
-sxffff(lookingforjob);
2016-2-11
(#9938564@0)
-
answer='';"939159".split("").forEach(function(element, index, array) {
answer+=(String.fromCharCode(65-(index%2)*17 + +1*element));
}
);answer
-firetrain(火车头);
2016-2-10
(#9938500@0)
-
looks very interesting; is '0' returning 'A0A0A0', '1' returns 'A0A0A1' ?
-mustang(大叔);
2016-2-10
(#9938529@0)
-
看不懂, 能解析一下吗?
-sxffff(lookingforjob);
2016-2-11
(#9938566@0)
-
1000001 的结果是什么?
-sxffff(lookingforjob);
2016-2-11
(#9938570@0)
-
My code in C# (replaced leading spaces with dots to maintenance indentation). I used only basic language elements and it's easy to convert into other languages like Java or C or C++. Output of the numbers mentioned above are appended as well.
-benbenli(大岭);
2016-2-11
{1656}
(#9938882@0)