我要像“我的狗”的字符串分割成数组的字符串:分裂没有分隔符
| M | y | space char will be in here | D | o | g |
这里是我的代码:
String []in_array;
input = sc.next();
in_array = input.split(""); //Note this there is no delimiter
for(int k=1; k < in_array.length; k++){
System.out.print(" "+in_array[k]);
}
编辑:
它只打印出“我的”
那么,什么happends? –
问题是什么?它有用吗?如果不是,它做错了什么? –
好吧,在我的电脑上,它会打印出“我的狗”。请重新测试它。你的输入是否真的包含:-'我的狗'? –