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


C++ basic_string::end方法代码示例

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


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

示例1: print_if_failed

 void print_if_failed(char const* func, bool result
   , std::basic_string<Char> const& generated, T const& expected)
 {
     if (!result)
         std::cerr << "in " << func << ": result is false" << std::endl;
     else if (generated != expected)
         std::cerr << "in " << func << ": generated \""
             << std::string(generated.begin(), generated.end())
             << "\"" << std::endl;
 }
开发者ID:Ruinland,项目名称:boost-doc-zh,代码行数:10,代码来源:test_manip_attr.hpp

示例2: i

std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
                         const basic_regex<charT, traits>& e, 
                         Formatter fmt,
                         match_flag_type flags = match_default)
{
   std::basic_string<charT> result;
   re_detail::string_out_iterator<std::basic_string<charT> > i(result);
   regex_replace(i, s.begin(), s.end(), e, fmt, flags);
   return result;
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:10,代码来源:regex_replace.hpp

示例3: IsPrintable

template< class CharT > bool IsPrintable( const std::basic_string< CharT >& str )
{
    const std::ctype< CharT > *pct = 0, &ct = tss::GetFacet( std::locale(), pct );
    for( std::basic_string< CharT >::const_iterator at = str.begin(); at != str.end(); at++ )
    {           
        if( ! ct.is( std::ctype_base::print, *at ) ) // if not printable
            return false;
    }

    return true;
}
开发者ID:jiangzhw,项目名称:tripwire-open-source,代码行数:11,代码来源:displayencoder_t.cpp

示例4: result

std::basic_string <CharType, TraitsType, AllocType>
lowercase( const std::basic_string <CharType, TraitsType, AllocType> & s )
{
    std::basic_string <CharType, TraitsType, AllocType> result( s.length(), '\0' );
    std::transform(
        s.begin(),
        s.end(),
        result.begin(),
        std::ptr_fun <int, int> ( std::tolower )
    );
    return result;
}
开发者ID:ColtonPhillips,项目名称:vtn-theme,代码行数:12,代码来源:generate_theme.cpp

示例5: countUnique

int countUnique(const std::basic_string<T>& s) {
   using std::basic_string;

   basic_string<T> chars;

   for (typename basic_string<T>::const_iterator p = s.begin( );
        p != s.end( ); ++p) {
     if (chars.find(*p) == basic_string<T>::npos)
        chars += *p;
   }
   return(chars.length( ));
}
开发者ID:jervisfm,项目名称:ExampleCode,代码行数:12,代码来源:4-16.cpp

示例6:

inline std::basic_string<Char> regex_replace
(
    std::basic_string<Char> const &str
  , basic_regex<typename std::basic_string<Char>::const_iterator> const &re
  , std::basic_string<Char> const &fmt
  , regex_constants::match_flag_type flags = regex_constants::match_default
)
{
    std::basic_string<Char> result;
    result.reserve(fmt.length() * 2);
    regex_replace(std::back_inserter(result), str.begin(), str.end(), re, fmt, flags);
    return result;
}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:13,代码来源:regex_algorithms.hpp

示例7: move

		std::basic_string < Elem, Traits > cell_encode(std::basic_string < Elem, Traits > Str, Elem Sep_, Elem Esc){
			if(Str.find(Sep_) < Str.size() || Str.find(Esc) < Str.size()){
				for(auto itr = Str.begin(); itr != Str.end(); ++itr){
					if(*itr == Esc){
						itr = Str.insert(++itr, Esc);
					}
				}

				Str.insert(Str.begin(), Esc);
				Str.push_back(Esc);
			}

			return std::move(Str);
		}
开发者ID:HomuraVehicle,项目名称:hmLib,代码行数:14,代码来源:csv_iterator.hpp

示例8: trim

 std::basic_string<Ch> trim(const std::basic_string<Ch> &s,
                            const std::locale &loc = std::locale())
 {
     typename std::basic_string<Ch>::const_iterator first = s.begin();
     typename std::basic_string<Ch>::const_iterator end = s.end();
     while (first != end && std::isspace(*first, loc))
         ++first;
     if (first == end)
         return std::basic_string<Ch>();
     typename std::basic_string<Ch>::const_iterator last = end;
     do --last; while (std::isspace(*last, loc));
     if (first != s.begin() || last + 1 != end)
         return std::basic_string<Ch>(first, last + 1);
     else
         return s;
 }
开发者ID:bigdoods,项目名称:OpenInfraPlatform,代码行数:16,代码来源:ptree_utils.hpp

示例9: Ch

 std::basic_string<Ch> encode_char_entities(const std::basic_string<Ch> &s)
 {
     typedef typename std::basic_string<Ch> Str;
     Str r;
     typename Str::const_iterator end = s.end();
     for (typename Str::const_iterator it = s.begin(); it != end; ++it)
     {
         switch (*it)
         {
             case Ch('<'): r += detail::widen<Ch>("&lt;"); break;
             case Ch('>'): r += detail::widen<Ch>("&gt;"); break;
             case Ch('&'): r += detail::widen<Ch>("&amp;"); break;
             default: r += *it; break;
         }
     }
     return r;
 }
开发者ID:craton-,项目名称:php_mapnik,代码行数:17,代码来源:xml_parser_utils.hpp

示例10: main

int main()
{
    std::locale l = std::locale::classic();
    const std::basic_string<F::extern_type> from("some text");
    const std::basic_string<F::intern_type> expected(from.begin(), from.end());
    std::basic_string<F::intern_type> to(from.size(), F::intern_type());
    const F& f = std::use_facet<F>(l);
    std::mbstate_t mbs = {};
    const F::extern_type* from_next = 0;
    F::intern_type* to_next = 0;
    F::result r = f.in(mbs, from.data(), from.data() + from.size(), from_next,
                            &to[0], &to[0] + to.size(), to_next);
    assert(r == F::ok);
    assert(from_next - from.data() == from.size());
    assert(to_next - to.data() == expected.size());
    assert(to_next - to.data() == expected.size());
    assert(to == expected);
}
开发者ID:32bitmicro,项目名称:riscv-libcxx,代码行数:18,代码来源:wchar_t_in.pass.cpp

示例11: condense

 std::basic_string<Ch> condense(const std::basic_string<Ch> &s)
 {
     std::basic_string<Ch> r;
     std::locale loc;
     bool space = false;
     typename std::basic_string<Ch>::const_iterator end = s.end();
     for (typename std::basic_string<Ch>::const_iterator it = s.begin();
          it != end; ++it)
     {
         if (isspace(*it, loc) || *it == Ch('\n'))
         {
             if (!space)
                 r += Ch(' '), space = true;
         }
         else
             r += *it, space = false;
     }
     return r;
 }
开发者ID:craton-,项目名称:php_mapnik,代码行数:19,代码来源:xml_parser_utils.hpp

示例12: if

    std::basic_string<Ch> create_escapes(const std::basic_string<Ch> &s)
    {
        std::basic_string<Ch> result;
        typename std::basic_string<Ch>::const_iterator b = s.begin();
        typename std::basic_string<Ch>::const_iterator e = s.end();
        while (b != e)
        {
            // This assumes an ASCII superset. But so does everything in PTree.
            // We escape everything outside ASCII, because this code can't
            // handle high unicode characters.
            if (*b == 0x20 || *b == 0x21 || (*b >= 0x23 && *b <= 0x2E) ||
                (*b >= 0x30 && *b <= 0x5B) || (*b >= 0x5D && *b <= 0xFF) || 
				(*b >= -0x80 && *b < 0))  // PATCH!!! Patched by the "iCardClient" developing team, this will pass UTF-8 signed chars.
                result += *b;
            else if (*b == Ch('\b')) result += Ch('\\'), result += Ch('b');
            else if (*b == Ch('\f')) result += Ch('\\'), result += Ch('f');
            else if (*b == Ch('\n')) result += Ch('\\'), result += Ch('n');
            else if (*b == Ch('\r')) result += Ch('\\'), result += Ch('r');
            else if (*b == Ch('\t')) result += Ch('\\'), result += Ch('t');
            else if (*b == Ch('/')) result += Ch('\\'), result += Ch('/');
            else if (*b == Ch('"'))  result += Ch('\\'), result += Ch('"');
            else if (*b == Ch('\\')) result += Ch('\\'), result += Ch('\\');
            else
            {
                const char *hexdigits = "0123456789ABCDEF";
                typedef typename make_unsigned<Ch>::type UCh;
                unsigned long u = (std::min)(static_cast<unsigned long>(
                                                 static_cast<UCh>(*b)),
                                             0xFFFFul);
                int d1 = u / 4096; u -= d1 * 4096;
                int d2 = u / 256; u -= d2 * 256;
                int d3 = u / 16; u -= d3 * 16;
                int d4 = u;
                result += Ch('\\'); result += Ch('u');
                result += Ch(hexdigits[d1]); result += Ch(hexdigits[d2]);
                result += Ch(hexdigits[d3]); result += Ch(hexdigits[d4]);
				result += *b;
            }
            ++b;
        }
        return result;
    }
开发者ID:letianzj,项目名称:DiLiGrp-eTradeClient,代码行数:42,代码来源:json_parser_write.hpp

示例13: TrimLeft

    void IO::TrimLeft(std::basic_string<charType> & str, const char* chars2remove)
    {
        if (!str.empty())   //trim the characters in chars2remove from the left
        {
            std::string::size_type pos = 0;
            if (chars2remove != NULL)
            {
                pos = str.find_first_not_of(chars2remove);

                if (pos != std::string::npos)
                    str.erase(0,pos);
                else
                    str.erase( str.begin() , str.end() ); // make empty
            }
            else        //trim space
            {
                pos = std::string::npos;        //pos = -1
                for (size_t i = 0; i < str.size(); ++i)
                {
                    if (!isspace(str[i]))
                    {
                        pos = i;
                        break;
                    }
                }
                if (pos != std::string::npos)
                {
                    if (pos > 0)
                    {
                        size_t length = str.size() - pos;
                        for (size_t i = 0; i < length; ++i) str[i] = str[i+pos];
                        str.resize(length);
                    }
                }
                else
                {
                    str.clear();
                }
            }
        }
    }
开发者ID:ZhouCS,项目名称:libvot,代码行数:41,代码来源:io_utils.cpp

示例14: tok

 std::vector<std::basic_string<charT> > 
 split_unix(
       const std::basic_string<charT>& cmdline, 
       const std::basic_string<charT>& seperator, 
       const std::basic_string<charT>& quote, 
       const std::basic_string<charT>& escape)
 {   
    typedef boost::tokenizer< boost::escaped_list_separator<charT>, 
          typename std::basic_string<charT>::const_iterator, 
          std::basic_string<charT> >  tokenizerT;
       
    tokenizerT tok(cmdline.begin(), cmdline.end(), 
              boost::escaped_list_separator< charT >(escape, seperator, quote));
       
    std::vector< std::basic_string<charT> > result;
    for (typename tokenizerT::iterator cur_token(tok.begin()), end_token(tok.end()); cur_token != end_token; ++cur_token) {
       if (!cur_token->empty())
          result.push_back(*cur_token);
    }
    return result;
 }
开发者ID:AngryPowman,项目名称:vnoc,代码行数:21,代码来源:split.cpp

示例15: if

std::string utf32_to_utf8(const std::basic_string<unsigned int> &s)
{
  std::string result;
  
  result.reserve(s.size()); // at least that long

  for(std::basic_string<unsigned int>::const_iterator
      it=s.begin();
      it!=s.end();
      it++)
  {  
    register unsigned int c=*it;
  
    if(c<=0x7f)           
      result+=char(c);
    else if(c<=0x7ff)
    {
      result+=char((c >> 6)   | 0xc0);
      result+=char((c & 0x3f) | 0x80);
    }
    else if(c<=0xffff)
开发者ID:hc825b,项目名称:static_analysis,代码行数:21,代码来源:unicode.cpp


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