Android如何将int转换为String? [英] Android how to convert int to String?

查看:109
本文介绍了Android如何将int转换为String?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个int,我想将其转换为字符串.应该简单吧?但是编译器抱怨当我这样做时找不到符号:

I have an int and I want to convert it to a string. Should be simple, right? But the compiler complains it can't find the symbol when I do:

int tmpInt = 10;
String tmpStr10 = String.valueOf(tmpInt);

以上内容有什么问题?而且,如何将int(或long)转换为String?

What is wrong with the above? And, how do I convert an int (or long) to a String?

valueOf不是valueof;)

valueOf not valueof ;)

推荐答案

使用此 String.valueOf(value);

这篇关于Android如何将int转换为String?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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