tables::column::substr
1)
column<std::string_view>
column<std::string_view>::substr(const std::size_t pos = 0, const std::size_t count = std::string::npos) const;
2)
column<std::string_view>
substr(const column<std::size_t>& pos, const column<std::size_t>& count) const;
-
Returns column with substring starts at position
pos
, of lengthcount
. -
Returns column with substring using positions and lenghts indicated in columns
pos
andcount
.
Example
Code
#include <cpptables/table.hh>
using namespace tables;
using namespace std;
void column_substr()
{
using sv_column = column<std::string_view>;
using sz_column = column<std::size_t>;
const sv_column xs({
"abc def ghi",
"foo bar xyz",
"hello world"
});
cout << xs.substr(0,3) << "\n";
cout << xs.substr(
sz_column({0, 4, 6}),
sz_column({3, 3, 5})
) << "\n";
}