Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
commons-lang StringUtils.removeEndに相当する Guava を見つけるのに苦労しています。そのような方法はありますか、または何らかの方法でジョイナーとスプリッターを使用する必要がありますか?
Guava がそのような方法を提供しているとは思いませんが、簡単なワンライナーです。
s = s.endsWith(suffix) ? s.substring(0, s.length() - suffix.length()) : s;