当前位置: 首页>>代码示例>>C++>>正文


C++ string_type::assign方法代码示例

本文整理汇总了C++中string_type::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ string_type::assign方法的具体用法?C++ string_type::assign怎么用?C++ string_type::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string_type的用法示例。


在下文中一共展示了string_type::assign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExtractToken

/** \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;
}
开发者ID:MirkoFl,项目名称:math-parser-benchmark-project,代码行数:21,代码来源:mpTokenReader.cpp

示例2: extract_element_content

 //------------------------------------------------------------------
 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);
 }
开发者ID:NNemec,项目名称:antigrain,代码行数:6,代码来源:agdoc_index_storage.cpp


注:本文中的string_type::assign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。