/** \brief Extract all characters that belong to a certain charset.
    \param a_szCharSet [in] Const char array of the characters allowed in the token.
    \param a_strTok [out]  The string that consists entirely of characters listed in a_szCharSet.
    \param a_iPos [in] Position in the string from where to start reading.
    \return The Position of the first character not listed in a_szCharSet.
    \throw nothrow
    */
int TokenReader::ExtractToken(const char_type *a_szCharSet,
    string_type &a_sTok,
    int a_iPos) const
{
    int iEnd = (int)m_sExpr.find_first_not_of(a_szCharSet, a_iPos);

    if (iEnd == (int)string_type::npos)
        iEnd = (int)m_sExpr.length();

    if (iEnd != a_iPos)
        a_sTok.assign(m_sExpr.begin() + a_iPos, m_sExpr.begin() + iEnd);

    return iEnd;
}
Exemplo n.º 2
0
 //------------------------------------------------------------------
 void index_storage::extract_element_content(const element& e, string_type& ret) const
 {
     ret.assign(e.content(), e.content_len());
     clean_and_trim_string(ret);
 }