String test="This is a simple text"
是否可以通过查看空格来检测空格并写入下一行?我的意思是有这样的控制台输出:
This is a simple text
++++ ++ + ++++++ ++++
最佳答案
public class StringPlus {
public static void main(String[] args) {
String test="This is a simple text";
for(char c: test.toCharArray()){
System.out.print((c == ' ') ? " ":"+");
}
}
}
关于java - 如何检测字符串中的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20576758/