Removal of a substring if it is at the end of a source string, otherwise returns the source string. A null source string will return null. An empty ("") source string will return the empty string. A null search string will return the source string. Case-sensiti
(final String str, final CharSequence remove)
| 1160 | * @return the substring with the string removed if found, {@code null} if null String input |
| 1161 | */ |
| 1162 | public String removeEnd(final String str, final CharSequence remove) { |
| 1163 | if (StringUtils.isEmpty(str) || StringUtils.isEmpty(remove)) { |
| 1164 | return str; |
| 1165 | } |
| 1166 | if (endsWith(str, remove)) { |
| 1167 | return str.substring(0, str.length() - remove.length()); |
| 1168 | } |
| 1169 | return str; |
| 1170 | } |
| 1171 | |
| 1172 | /** |
| 1173 | * Removal of a substring if it is at the beginning of a source string, otherwise returns the source string. |