Get the last token from (and excluding) the separating character.

@param sStr
The string to search. May be <code>null</code>.
@param cSearch
The search character.
@return The passed string if no such separator token was found.
186460
@Nullable
  public static String getLastToken (@Nullable final String sStr, final char cSearch)
  {
    final int nIndex = getLastIndexOf (sStr, cSearch);
    return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + 1);
  }
860484
@Nonnull
  public CSVWriter setSeparatorChar (final char cSeparator)
  {
    if (cSeparator == CCSV.NULL_CHARACTER)
      throw new UnsupportedOperationException ("The separator character must be defined!");
    m_cSeparatorChar = cSeparator;
    return this;
  }
1059629
public StrPosition getAfterOfWithDetails(String srcStr, String token) {
        return getAfterOfWithDetails(srcStr, token, true);
    }
1075206
public List<String> getStringEnclosedIn(String srcStr, String startToken, String endToken) {
        List<StrPosition> resultList = getStringEnclosedInWithDetails(srcStr, startToken, endToken);
        List<String> retList = new ArrayList<String>();
        for (StrPosition sp : resultList) {
            retList.add(sp.str);
        }
        return retList;
    }
688253
private String[] jsSplit(String stringValue, String separator, int limit) {
    checkArgument(limit >= 0);
    checkArgument(stringValue != null);

    // For limits of 0, return an empty array
    if (limit == 0) {
      return new String[0];
    }

    // If a separator is not specified, return the entire string as
    // the only element of an array.
    if (separator == null) {
      return new String[] {stringValue};
    }

    List<String> splitStrings = new ArrayList<>();

    // If an empty string is specified for the separator, split apart each
    // character of the string.
    if (separator.isEmpty()) {
      for (int i = 0; i < stringValue.length() && i < limit; i++) {
        splitStrings.add(stringValue.substring(i, i + 1));
      }
    } else {
      int startIndex = 0;
      int matchIndex;
      while ((matchIndex =
          jsSplitMatch(stringValue, startIndex, separator)) >= 0 &&
          splitStrings.size() < limit) {
        splitStrings.add(stringValue.substring(startIndex, matchIndex));

        startIndex = matchIndex + separator.length();
      }

      if (splitStrings.size() < limit) {
        if (startIndex < stringValue.length()) {
          splitStrings.add(stringValue.substring(startIndex));
        } else {
          splitStrings.add("");
        }
      }
    }

    return splitStrings.toArray(new String[0]);
  }
91760
public static String decode(String s, Charset cs) {
        boolean needToChange = false;
        int numChars = s.length();
        StringBuilder sb = new StringBuilder(numChars > 500 ? numChars / 2 : numChars); // MTD: Using StringBuilder instead of StringBuffer
        int i = 0;

        char c;
        byte[] bytes = null;
        while (i < numChars) {
            c = s.charAt(i);
            switch (c) {
            case '+':
                sb.append(' ');
                i++;
                needToChange = true;
                break;
            case '%':
                /*
                 * Starting with this instance of %, process all
                 * consecutive substrings of the form %xy. Each
                 * substring %xy will yield a byte. Convert all
                 * consecutive  bytes obtained this way to whatever
                 * character(s) they represent in the provided
                 * encoding.
                 */

                try {

                    // (numChars-i)/3 is an upper bound for the number
                    // of remaining bytes
                    if (bytes == null)
                        bytes = new byte[(numChars-i)/3];
                    int pos = 0;

                    while ( ((i+2) < numChars) &&
                            (c=='%')) {
                        int v = Integer.parseInt(s.substring(i+1,i+3),16);
                        if (v < 0)
                            throw new IllegalArgumentException("ExtendedURLDecoder: Illegal hex characters in escape (%) pattern - negative value");
                        bytes[pos++] = (byte) v;
                        i+= 3;
                        if (i < numChars)
                            c = s.charAt(i);
                    }

                    // A trailing, incomplete byte encoding such as
                    // "%x" will cause an exception to be thrown

                    if ((i < numChars) && (c=='%'))
                        throw new IllegalArgumentException(
                         "ExtendedURLDecoder: Incomplete trailing escape (%) pattern");

                    sb.append(new String(bytes, 0, pos, cs)); // MTD: Using the Charset directly instead of first have to look it up from a string at this point
                } catch (NumberFormatException e) {
                    throw new IllegalArgumentException(
                    "ExtendedURLDecoder: Illegal hex characters in escape (%) pattern - "
                    + e.getMessage());
                }
                needToChange = true;
                break;
            default:
                sb.append(c);
                i++;
                break;
            }
        }

        return (needToChange? sb.toString() : s);
    }
239916
public String getRightOf(String srcStr, int charCount) {

        String retVal = "";

        if (isNotBlank(srcStr)) {

            int length = srcStr.length();

            if (charCount < length) {
                retVal = srcStr.substring(length - charCount, length);
            } else {
                retVal = srcStr;
            }
        } else {

        }

        return retVal;
    }
24659
static String cssContent(String token) {
    int n = token.length();
    int pos = 0;
    StringBuilder sb = null;
    if (n >= 2) {
      char ch0 = token.charAt(0);
      if (ch0 == '"' || ch0 == '\'') {
        if (ch0 == token.charAt(n - 1)) {
          pos = 1;
          --n;
          sb = new StringBuilder(n);
        }
      }
    }
    for (int esc; (esc = token.indexOf('\\', pos)) >= 0;) {
      int end = esc + 2;
      if (esc > n) { break; }
      if (sb == null) { sb = new StringBuilder(n); }
      sb.append(token, pos, esc);
      int codepoint = token.charAt(end - 1);
      if (isHex(codepoint)) {
        // Parse \hhhhh<opt-break> where hhhhh is one or more hex digits
        // and <opt-break> is an optional space or tab character that can be
        // used to separate an escape sequence from a following literal hex
        // digit.
        while (end < n && isHex(token.charAt(end))) { ++end; }
        try {
          codepoint = Integer.parseInt(token.substring(esc + 1, end), 16);
        } catch (RuntimeException ex) {
          ignore(ex);
          codepoint = 0xfffd;  // Unknown codepoint.
        }
        if (end < n) {
          char ch = token.charAt(end);
          if (ch == ' ' || ch == '\t') {  // Ignorable hex follower.
            ++end;
          }
        }
      }
      sb.appendCodePoint(codepoint);
      pos = end;
    }
    if (sb == null) { return token; }
    return sb.append(token, pos, n).toString();
  }
224767
function() {
    // Get the start search index
    var i = index;
    // Locate the end of the c string
    while(buffer[i] !== 0x00 && i < buffer.length) { 
      i++ 
    }
    // If are at the end of the buffer there is a problem with the document
    if(i >= buffer.length) throw new Error("Bad BSON Document: illegal CString")
    // Grab utf8 encoded string
    var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i);
    // Update index position
    index = i + 1;
    // Return string
    return string;
  }
1008017
@Nonnull
  @ReturnsMutableCopy
  public ICommonsMap <String, String> parse (@Nullable final String sStr, final char cSeparator)
  {
    final ICommonsMap <String, String> ret = new CommonsHashMap <> ();
    if (sStr != null)
    {
      final char [] aChars = sStr.toCharArray ();
      m_aChars = aChars;
      m_nPos = 0;
      m_nLen = sStr.length ();

      while (_hasChar ())
      {
        String sParamName = _parseToken ('=', cSeparator);
        String sParamValue = null;
        if (_hasChar () && aChars[m_nPos] == '=')
        {
          // skip '='
          m_nPos++;
          sParamValue = _parseQuotedToken (cSeparator);
        }
        if (_hasChar () && aChars[m_nPos] == cSeparator)
        {
          // skip separator
          m_nPos++;
        }
        if (StringHelper.hasText (sParamName))
        {
          if (m_bLowerCaseNames)
            sParamName = sParamName.toLowerCase (Locale.US);
          ret.put (sParamName, sParamValue);
        }
      }
    }
    return ret;
  }
848395
function getCSRFToken() {
		if (typeof document === "undefined") return null;
		var cookies = document.cookie.split(";");//$NON-NLS-0$

		var i,n,v;
		for(i = 0; i<cookies.length; i++) {
			n = cookies[i].substr(0, cookies[i].indexOf("=")).trim();//$NON-NLS-0$
			v = cookies[i].substr(cookies[i].indexOf("=") + 1).trim();//$NON-NLS-0$

			if(n.endsWith(XSRF_TOKEN)) {
				return v;
			}
		}
	}
635602
@Override
    public String nextToken(String delim)
        throws NoSuchElementException
    {
        _delim=delim;
        _i=_lastStart;
        _token.setLength(0);
        _hasToken=false;
        return nextToken();
    }
1189777
public static String[] split(String str, String separator, boolean trim) {
        if (str == null) {
            return null;
        }

        char sep = separator.charAt(0);

        ArrayList<String> strList = new ArrayList<String>();
        StringBuilder split = new StringBuilder();
        int index = 0;
        while ((index = StringUtils.findNext(str, sep, StringUtils.ESCAPE_CHAR, index, split)) >= 0) {
            ++index; // move over the separator for next search
            strList.add(split.toString());
            split.setLength(0); // reset the buffer
        }

        strList.add(split.toString());
        // remove trailing empty split(s)
        if (trim) {
            int last = strList.size(); // last split
            while (--last>=0 && "".equals(strList.get(last))) {
                strList.remove(last);
            }
        }

        return strList.toArray(new String[strList.size()]);
    }
593143
public static int lastIndexOfLetter(String string) {
    for (int i = 0; i < string.length(); i++) {
      char character = string.charAt(i);
      // Include "_".  See HHH-8073
      if (!Character.isLetter(character) && !('_' == character)) return i - 1;
    }
    return string.length() - 1;
  }
687551
@Override
  public CharSegment getHeaderBuffer(String key)
  {
    int i = matchNextHeader(0, key);

    if (i >= 0) {
      return _headerValues[i];
    }
    else {
      return null;
    }
  }
82208
public String nextToken(String separators) {
        separator = 0;
        if (peek != null) {
            String tmp = peek;
            peek = null;
            return tmp;
        }

        if (index == string.length()) {
            return null;
        }

        StringBuilder sb = new StringBuilder();

        boolean hadstring = false; // means no further trimming
        boolean validspace = false; // means include spaces

        while (index < string.length()) {
            char c = string.charAt(index++);

            if (Character.isWhitespace(c)) {
                if (index == string.length()) {
                    break;
                }

                if (validspace) {
                    sb.append(c);
                }

                continue;
            }

            if (separators.indexOf(c) >= 0) {
                if (returnTokens) {
                    peek = Character.toString(c);
                } else {
                    separator = c;
                }
                break;
            }

            switch (c) {
                case '"':
                case '\'':
                    hadstring = true;
                    quotedString(sb, c);
                    // skip remaining space
                    validspace = false;
                    break;

                default:
                    sb.append(c);
                    validspace = true;
            }
        }
        String result = sb.toString();
        if (!hadstring) {
            result = result.trim();
        }

        if (result.length() == 0 && index == string.length()) {
            return null;
        }
        return result;
    }
1001923
public static Boolean checkTokenBoundaries(MatchResult r, Sentence s, JCas jcas){
		Boolean beginOK = false;
		Boolean endOK = false;
	
		// whole expression is marked as a sentence
		if ((r.end() - r.start()) == (s.getEnd() -s.getBegin())){
			return true;
		}
		
		// Only check Token boundaries if no white-spaces in front of and behind the match-result
		if ((r.start() > 0) 
				&& ((s.getCoveredText().subSequence(r.start()-1, r.start()).equals(" ")))
				&& ((r.end() < s.getCoveredText().length()) && ((s.getCoveredText().subSequence(r.end(), r.end()+1).equals(" "))))) {
			return true;
		}
	
		// other token boundaries than white-spaces
		else {
			FSIterator iterToken = jcas.getAnnotationIndex(Token.type).subiterator(s);
			while (iterToken.hasNext()) {
				Token t = (Token) iterToken.next();
			
				// Check begin
				if ((r.start() + s.getBegin()) == t.getBegin()){
					beginOK = true;
				}
				// Tokenizer does not split number from some symbols (".", "/", "-", "–"),
				// e.g., "...12 August-24 Augsut..."
				else if ((r.start() > 0)
						&& ((s.getCoveredText().subSequence(r.start()-1, r.start()).equals("."))
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("/")) 
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("–"))
						|| (s.getCoveredText().subSequence(r.start()-1, r.start()).equals("-")))) {
					beginOK = true;
				}
			
				// Check end
				if ((r.end() + s.getBegin()) == t.getEnd()) {
					endOK = true;
				}
				// Tokenizer does not split number from some symbols (".", "/", "-", "–"),
				// e.g., "... in 1990. New Sentence ..."
				else if ((r.end() < s.getCoveredText().length()) 
						&& ((s.getCoveredText().subSequence(r.end(), r.end()+1).equals("."))
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("/"))
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("–")) 
								|| (s.getCoveredText().subSequence(r.end(), r.end()+1).equals("-")))) {
					endOK = true;
				}
			
				if (beginOK && endOK)
					return true;
			}
		}
		return false;
	}