我想把最后一个字符串
假设字符串是:
,
替换为)
。假设字符串是:
它需要转换为:Insert into dual (name,date,
Insert into dual (name,date)
,
替换为)
。它需要转换为:Insert into dual (name,date,
Insert into dual (name,date)
如果你可以做到以下的事情,那么为什么还要麻烦呢?
word = (String) word.subSequence(0, word.length() -1);
这将返回一个新的字符串,该字符串不包含原始字符串的最后一部分。