社区
Java SE
帖子详情
求助,int型数组怎么转化成字符串啊?
wo327808864
2010-03-18 10:21:05
求助,int型数组怎么转化成字符串啊?
...全文
324
8
打赏
收藏
求助,int型数组怎么转化成字符串啊?
求助,int型数组怎么转化成字符串啊?
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
machao299
2010-03-18
打赏
举报
回复
[Quote=引用 5 楼 knightzhuwei 的回复:]
Arrays.toString(int[] i)
[/Quote]
多方便、
Dazzlingwinter
2010-03-18
打赏
举报
回复
Arrays数组工具类有对应的方法咯,比较好用了
我没运行,前面有循环了,里面的++去掉就好了
for(int i: a) {
strBuff.append(a[i]);
}
wo327808864
2010-03-18
打赏
举报
回复
[Quote=引用 4 楼 wo327808864 的回复:]
引用 1 楼 dazzlingwinter 的回复:
1.int[] a = new int[]{1,2,3,4,5,6};
StringBuffer strBuff = new StringBuff();
for(int i: a) {
strBuff.append(a[i++]);
}
return strBuff.toString();
2.
将int数组转为字符数组
ch……
[/Quote]
int[] a = new int[]{1,2,3,4,5,6};
StringBuffer strBuff = new StringBuff();
for(int i: a) {
strBuff.append(a[i++]);
}
return strBuff.toString();
应该是strBuff.append(a[--i])吧
knightzhuwei
2010-03-18
打赏
举报
回复
Arrays.toString(int[] i)
wo327808864
2010-03-18
打赏
举报
回复
[Quote=引用 1 楼 dazzlingwinter 的回复:]
1.int[] a = new int[]{1,2,3,4,5,6};
StringBuffer strBuff = new StringBuff();
for(int i: a) {
strBuff.append(a[i++]);
}
return strBuff.toString();
2.
将int数组转为字符数组
char[] c = int[] a;//伪代码咯
ret……
[/Quote]
问下有API的方法直接转的没?没的话就结贴了
lhlove271015
2010-03-18
打赏
举报
回复
2楼的正解
lhlove271015
2010-03-18
打赏
举报
回复
楼主是要把int型数组转化为字符串数组吗?
Dazzlingwinter
2010-03-18
打赏
举报
回复
1.int[] a = new int[]{1,2,3,4,5,6};
StringBuffer strBuff = new StringBuff();
for(int i: a) {
strBuff.append(a[i++]);
}
return strBuff.toString();
2.
将int数组转为字符数组
char[] c = int[] a;//伪代码咯
return new String(c);
字符串
指针与char
型
指针
数组
一、
字符串
指针
字符串
是一种特殊的char
型
数组
,指向char类
型
数组
的指针,就是
字符串
指针。与普通指针一样,
字符串
指针在使用前也必须定义。
字符串
与char
数组
的区别在于长度,字符会自动在尾部加上一个长度‘\0’,而char
型
数组
的长度就是其字符的个数。
字符串
长度是字符个数+1。例: #include using namespace std;
int
main() { char s
【C】C语言
int
型
数组
转化为char
型
字符串
数组
文章目录C语言
int
型
数组
转化为char
型
字符串
数组
一、代码二、结果三、说明 C语言
int
型
数组
转化为char
型
字符串
数组
一、代码 /* 程序功能:
int
型
数组
转化为char
型
字符串
数组
*/ #include <stdio.h> #include <stdlib.h> #include <math.h>
int
n...
【C】C语言判断
字符串
是否是
int
型
正整数
文章目录【C】C语言判断
字符串
是否是
int
型
正整数前言一、代码二、结果 【C】C语言判断
字符串
是否是
int
型
正整数 前言 此程序功能主要是实现:判断在CMD下输入的
字符串
是是否是
int
型
的正整数。 &nb
字符串
、字符
数组
与
int
型
数据的相互转换
1.
int
转String
int
型
数据转化为String有以下三种方法: ① valueOf(Type parameter):返回类
型
参数的
字符串
表示形式。 ② toString():返回表示此整数值的
字符串
对象。 toString(
int
i,
int
radix):返回由第二个参数指定的基数的第一个参数的
字符串
表示形式。如radix=2,则返回二进制
字符串
。...
Java将String
型
字符串
转换成
int
型
(或
int
型
数组
)
转换成
int
型
数组
代码实现 String str = "6921168509256";
int
[] arr = new
int
[str.length()]; for (
int
i = 0; i < str.length(); i++) { arr[i] =
Int
eger.parse
Int
(str.substring(i, i + 1));//s...
Java SE
62,620
社区成员
307,251
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章