libzypp  17.25.6
StringV.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <zypp/base/StringV.h>
13 
15 namespace zypp
16 {
17  namespace strv
18  {
19 
20  unsigned split( std::string_view line_r, std::string_view sep_r, Trim trim_r,
21  std::function<void(std::string_view)> fnc_r )
22  {
23 #warning REIMPLEMENT
24  std::vector<std::string> words;
25  str::split( std::string(line_r), std::back_inserter(words), std::string(sep_r), str::TRIM );
26 
27  if ( fnc_r ) {
28  for ( const auto & w : words )
29  fnc_r( std::string_view(w) );
30  }
31  return words.size();
32  }
33 
34  } // namespace strv
35 } // namespace zypp
c++17: std::string_view tools
Trim
To define how to trim.
Definition: String.h:493
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition: String.h:527
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
unsigned split(std::string_view line_r, std::string_view sep_r, Trim trim_r, std::function< void(std::string_view)> fnc_r)
Definition: StringV.cc:20