最后出现一个字符后删除字符串

最后出现一个字符后删除字符串,第1张

最后出现一个字符删除字符串

您可以使用

lastIndexOf()
相同的方法

if (null != str && str.length() > 0 ){    int endIndex = str.lastIndexOf("/");    if (endIndex != -1)      {        String newstr = str.substring(0, endIndex); // not forgot to put check if(endIndex != -1)    }}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5020703.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-14
下一篇 2022-11-14

发表评论

登录后才能评论

评论列表(0条)

保存