Java Utililty Methods String Chop Right

List of utility methods to do String Chop Right

Description

The list of methods to do String Chop Right are organized into topic(s).

Method

StringchopFromRight(String text, char character, int count)
Chop the string off up to the last occurrence of character.
String target = text;
int inTotal = countOf(character, text);
if (inTotal > count && count > 0) {
    int total = (inTotal - count) + 1;
    int indexFrom = 0;
    int nextIndex = 0;
    while (total > 0) {
        nextIndex = text.indexOf(character, indexFrom);
...
StringchopRight(String str, char delimiter)
chop Right
if (str == null || "".equals(str)) {
    return str;
int pos;
for (pos = str.length() - 1; pos >= 0; pos--) {
    if (str.charAt(pos) != delimiter) {
        break;
return str.substring(0, pos + 1);