remove N chars from tail

@see StringGrabber#carryTail()
@param cnt
count of chars
@return
344066
public StringGrabber removeTail(int cnt) {
		int leng = sb.length();
		try {
			sb.delete(leng - cnt, leng);
		} catch (Exception e) {
		}
		return StringGrabber.this;
	}
1239884
private int countChar(String string, char c) {
        int count = 0;
        final int max = string.length();
        for (int i = 0; i < max; i++) {
            if (c == string.charAt(i)) {
                count++;
            }
        }
        return count;
    }
1242846
public static String trimTrailingCharacter(final String str, final char trailingCharacter) {
    if (!StringUtils.hasLength(str)) {
      return str;
    }

    final StringBuilder sb = new StringBuilder(str);
    while (sb.length() > 0 && sb.charAt(sb.length() - 1) == trailingCharacter) {
      sb.deleteCharAt(sb.length() - 1);
    }
    return sb.toString();
  }
226174
public static String deleteAny(String inString, String charsToDelete) {
        if (!hasLength(inString) || !hasLength(charsToDelete)) {
            return inString;
        }

        StringBuilder sb = new StringBuilder(inString.length());
        for (int i = 0; i < inString.length(); i++) {
            char c = inString.charAt(i);
            if (charsToDelete.indexOf(c) == -1) {
                sb.append(c);
            }
        }
        return sb.toString();
    }
170319
public char nextClean(char c) {
        char n = nextClean();
        if (n != c) {
            throw syntaxError("Expected '" + c + "' and instead saw '" + n + "'");
        }
        return n;
    }
1172146
private Node tryFoldStringCharCodeAt(Node n, Node stringNode, Node arg1) {
    checkArgument(n.isCall());
    checkArgument(stringNode.isString());

    int index;
    String stringAsString = stringNode.getString();

    if (arg1 != null && arg1.isNumber()
        && arg1.getNext() == null) {
      index = (int) arg1.getDouble();
    } else {
      return n;
    }

    if (index < 0 || stringAsString.length() <= index) {
      // http://es5.github.com/#x15.5.4.5 says NaN is returned when index is
      // out of bounds but we bail.
      return n;
    }

    Node resultNode = IR.number(stringAsString.charAt(index));
    Node parent = n.getParent();
    parent.replaceChild(n, resultNode);
    reportChangeToEnclosingScope(parent);
    return resultNode;
  }
450989
function trimStringEnds(keyValueString, unwantedCharArray) {
    var unwantedBegCharIndex = 0;
    var unwantedEndCharIndex = keyValueString.length - 1;
    var charIsUnwanted;
    var keepGoing = true; //keep traversing the string
    //starting from the beginning of the string
    while (keepGoing) {
        charIsUnwanted = false;
        for (var x = 0; x < unwantedCharArray.length; x++) {
            if (keyValueString.charAt(unwantedBegCharIndex) === unwantedCharArray[x]) {
                charIsUnwanted = true;
            }
        }
        if (!charIsUnwanted) {
            keepGoing = false;
        } else {
            unwantedBegCharIndex++;
        }
    }
    //now start at the end
    keepGoing = true;
    while (keepGoing) {
        charIsUnwanted = false;
        for (var y = 0; y < unwantedCharArray.length; y++) {
            if (keyValueString.charAt(unwantedEndCharIndex) === unwantedCharArray[y]) {
                charIsUnwanted = true;
            }
        }
        if (!charIsUnwanted) {
            keepGoing = false;
        } else {
            unwantedEndCharIndex--;
        }
    }
    keyValueString = keyValueString.slice(unwantedBegCharIndex, unwantedEndCharIndex + 1);
    return keyValueString;
}
732307
public char skip(int n)
  {
    _pos += n;
    
    if (_length <= _pos) {
      _pos = _string.length();
      return DONE;
    } else
      return _string.charAt(_pos);
  }
206254
public static int nthIndex(String s, char ch, int n) {
    int index = 0;
    for (int i = 0; i < n; i++) {
      // if we're already at the end of the string,
      // and we need to find another ch, return -1
      if (index == s.length() - 1) {
        return -1;
      }
      index = s.indexOf(ch, index + 1);
      if (index == -1) {
        return (-1);
      }
    }
    return index;
  }
56239
public static int getOccurenceCount(char c, String s) 
    {
        int ret = 0;

        for(int i = 0; i < s.length(); i++)
        {
            if(s.charAt(i) == c)
                ++ret;
        }

        return ret;
    }
631726
static public String removeTrailingNewLines(String string) {
    	if (string == null) return string;
    	
    	String trimmedString = chomp(string);

    	// Loop until the chomp-method does not remove any more trailing NewLines...
    	while (trimmedString.length() < string.length()) {
			// Try remove one more NewLine
    		string = trimmedString;
			trimmedString = chomp(string);
		}
    	
    	return trimmedString;
    	
    }
1051026
public static String repeatString(String str, int count) {
	if (count <= 0) return "";
	char[] chars = str.toCharArray();
	char[] rtn = new char[chars.length * count];
	int pos = 0;
	for (int i = 0; i < count; i++) {
	    for (int y = 0; y < chars.length; y++)
		rtn[pos++] = chars[y];
	    // rtn.append(str);
	}
	return new String(rtn);
    }
319735
@Nonnegative
  public static int getTrailingCharCount (@Nullable final String s, final char c)
  {
    int ret = 0;
    if (s != null)
    {
      int nLast = s.length () - 1;
      while (nLast >= 0 && s.charAt (nLast) == c)
      {
        ++ret;
        --nLast;
      }
    }
    return ret;
  }
1021071
function(cnt, compareResult){
    var splitter = compareResult.splitter,
        diff = compareResult.diff,
        result = cnt.split(splitter);

    for(var i = diff.length - 1, item; i >= 0; i--){
        item = diff[i];
        result.splice.apply(result, item);
    }

    return result.join(splitter);
}
544740
private int _countConsecutiveChars (final char ch)
  {
    int nCount = 0;
    for (int i = 0; i < m_sValue.length (); i++)
    {
      final char c = m_sValue.charAt (i);
      if (c != ' ')
      {
        if (c != ch)
          return 0;
        nCount++;
      }
    }
    return nCount;
  }
1369798
public long skip(long n) {
		long skipped=0L;
		int skip;
		while(n>0) {
			if(n<(skip=curr.remaining())) {
				curr.position(curr.position()+(int)n);
				skipped+=skip;
				n=0;
			} else {
				curr.position(curr.limit());
				
				skipped-=skip;
				if(idx<bbs.size()) {
					curr=bbs.get(idx++);
					n-=skip;
				} else {
					n=0;
				}
			}
		}
		return skipped;
	}
123952
public static CharSequence concat(CharSequence... text) {
        if (text.length == 0) {
            return "";
        }

        if (text.length == 1) {
            return text[0];
        }

        boolean spanned = false;
        for (int i = 0; i < text.length; i++) {
            if (text[i] instanceof Spanned) {
                spanned = true;
                break;
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < text.length; i++) {
            sb.append(text[i]);
        }

        if (!spanned) {
            return sb.toString();
        }

        SpannableString ss = new SpannableString(sb);
        int off = 0;
        for (int i = 0; i < text.length; i++) {
            int len = text[i].length();

            if (text[i] instanceof Spanned) {
                copySpansFrom((Spanned) text[i], 0, len, Object.class, ss, off);
            }

            off += len;
        }

        return new SpannedString(ss);
    }