Here you can find the source of chopRight(String str, char delimiter)
public static String chopRight(String str, char delimiter)
//package com.java2s; //License from project: Open Source License public class Main { public static String chopRight(String str, char delimiter) { if (str == null || "".equals(str)) { return str; }//from ww w .j ava2s . c o m int pos; for (pos = str.length() - 1; pos >= 0; pos--) { if (str.charAt(pos) != delimiter) { break; } } return str.substring(0, pos + 1); } }