显示了字符串数组。 需要的是char []。 这意味着所有字符串中所有字符的数组
例如:
输入:“我爱你”
输出: [i,l,o,v,e,y,o,u]
首先,我们建立了序列。
然后找到了所需的char []数组的长度。
到目前为止,我尝试了以下事情。
char [ ] [ ] a1=new char [ str.length ] [ ];
for(intI=0; I
a1[i]=str[i].toCharArray (;
}
int总=0;
for(intI=0; I
total=total a1[i].length;
}
char[] allchar=new char[total];
for(intI=0; I
//nowhereiwanttomergeallthechar [ ] arrays together。
//HOW SHOULD I DO THIS?
}
解决方法:
String[] sArray={'i ',' love ',' you'};
String s=' ';
for(stringn:Sarray ) )。
s=n;
char[] c=s.toCharArray (;
标签: java、arrays、字符串
资料来源: https://codeday.me/bug/2019 09 28/1829263.html