如何将整数转换为字符串?
我目前正在输入一个程序,并且很好奇我如何能够将整数输入更改为字母,但这是整数所需的特定次数。
例如,我向用户询问了他们有多少个苹果,然后他们输入了三个苹果,然后我将如何将“ 3”变成“ AAA”,或者如果他们输入11并且输出为“ AAAAAAAAAAAAA”。我希望这不是一个例子。
I'm currently typing up a program and was curious as to how I would be able to change an integer input into a letter but it would be the specific amount of times the integer would be.
As an example lets say I asked the user for how many apples they have and they typed in three, how would I then turn that "3" into "aaa", or like if they entered 11 and the output came as "aaaaaaaaaaa". I hope this isn't too bad of an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想编程,则必须自己做这些;
或者您可以使用Java strings.utils.repeat()函数
strings.utils
If you want to program, you'll have to do those yourself;
Or you can use Java Strings.Utils.repeat() function
Strings.Utils