code: public static String chop(String str) {
  		if (str == null) {
  			return null;
  		}
  		int strLen = str.length();
  		if (strLen < 2) {
  			return EMPTY;
  		}
  		int lastIdx = strLen - 1;
  		String ret = str.substring(0, lastIdx);
  		char last = str.charAt(lastIdx);
  		if (last == LF) {
  			if (ret.charAt(lastIdx - 1) == CR) {
  				return ret.substring(0, lastIdx - 1);
  			}
  		}
  		return ret;
  	}
docs: <p>
  Remove the last character from a String.
  </p>
  
  <p>
  If the String ends in <code>\r\n</code>, then remove both of them.
  </p>
  
  <pre>
  StringUtils.chop(null)          = null
  StringUtils.chop(&quot;&quot;)            = &quot;&quot;
  StringUtils.chop(&quot;abc \r&quot;)      = &quot;abc &quot;
  StringUtils.chop(&quot;abc\n&quot;)       = &quot;abc&quot;
  StringUtils.chop(&quot;abc\r\n&quot;)     = &quot;abc&quot;
  StringUtils.chop(&quot;abc&quot;)         = &quot;ab&quot;
  StringUtils.chop(&quot;abc\nabc&quot;)    = &quot;abc\nab&quot;
  StringUtils.chop(&quot;a&quot;)           = &quot;&quot;
  StringUtils.chop(&quot;\r&quot;)          = &quot;&quot;
  StringUtils.chop(&quot;\n&quot;)          = &quot;&quot;
  StringUtils.chop(&quot;\r\n&quot;)        = &quot;&quot;
  </pre>
  
  @param str the String to chop last character from, may be null
  @return String without last character, <code>null</code> if null String input