我可以用这个:
String str = "TextX Xto modifyX";
str = str.replace('X','');//that does not work because there is no such character ''
Run Code Online (Sandbox Code Playgroud)
有没有办法X从Java中的String中删除所有出现的字符?
我试过这个并不是我想要的: str.replace('X',' '); //replace with space
为了访问Java中String的单个字符,我们有String.charAt(2).是否有任何内置函数可以删除java中字符串的单个字符?
像这样的东西:
if(String.charAt(1) == String.charAt(2){
//I want to remove the individual character at index 2.
}
Run Code Online (Sandbox Code Playgroud) 我需要将输入限制为TextField为整数.有什么建议?
我正在寻找一个示例,使用新TextFormatter的Java8 u40 类将用户输入限制为仅数字和小数点.
http://download.java.net/jdk9/jfxdocs/javafx/scene/control/TextFormatter.Change.html