首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

判断最后的字符是否possible

2012-08-22 
判断最后的字符是不是possible1,判断最后的字符是不是possible, 用endswith方法,接下来再替换2,替换最后一

判断最后的字符是不是possible
1,判断最后的字符是不是possible, 用endswith方法,接下来再替换
2,替换最后一个可以变项的作

String s = "The possible problem is, How is that possible";
if(s.endsWith("possible")){
String s1 = s.substring(0, s.lastIndexOf("possible"));
s = s1 + "impossible";
}
System.out.println(s);

热点排行