求教,java中怎么判断字符串数组中的某个字符为空
java吧
全部回复
仅看楼主
level 5
VictorLee0321
楼主
大一新生,java作业,题目是遇到5就要当空格把字符串隔开,但是如果有连续两个5,那隔开就有空的字符串(不知道可不可以理解为空格);附图求教!
2014年02月18日 12点02分
1
level 5
VictorLee0321
楼主
作业啊,求教!
2014年02月18日 12点02分
2
level 11
茶涧小怸
String 有个replace方法 replace(CharSequence target, CharSequence replacement)
5换成“ 5”
2014年02月18日 12点02分
3
VictorLee0321
谢谢!
2014年02月19日 01点02分
level 8
卖字猴
sArray[y].equals("");
2014年02月19日 02点02分
4
卖字猴
产生的空字符串 是"";而不是null
2014年02月19日 02点02分
level 11
灬寄语蓝天
String有split方法
2014年02月19日 02点02分
5
level 10
晓晓mtgodd
直接用高级for做不就得了 搞这么麻烦
int[] iArray = new int[m];
for(int y: iArray){
if(y==null){
System.out.println("kao");
break;
}
System.out.println(y);
}
2014年02月19日 05点02分
7
晓晓mtgodd
话说也不能这么写 思路就是错的 你int哪来的null 那个只是""
2014年02月19日 05点02分
1