TextAdjustment#

class pandas::TextAdjustment#

pandas C++ class.

Example#

#include <pandas/pandas.h>
using namespace pandas;

// Use TextAdjustment
TextAdjustment obj;
// ... operations ...

Comparison#

Signature

Return Type

Location

Example

virtual size_t len(const std::string& s) const

virtual size_t

pd_text_adjust.h:16

View

Other Methods#

Signature

Return Type

Location

Example

virtual std::vector<std::string> justify( const std::vector<std::string>& strings, size_t max_len, std::string_view mode) const

virtual std::vector<std::string>

pd_text_adjust.h:22

Code Examples#

The following examples are extracted from the test suite.

len (pd_test_3_all.cpp:20867)
20857    auto title_result = s.str().title();
20858    if (title_result[0] != "Hello World" || title_result[1] != "Hello World" || title_result[2] != "Hello World") {
20859        std::cout << "  [FAIL] : title() failed" << std::endl;
20860        throw std::runtime_error("pd_test_str_capitalize_title: title() failed");
20861    }
20862
20863    std::cout << " -> tests passed" << std::endl;
20864}
20865
20866// ============================================================================
20867// Test str().len()
20868// ============================================================================
20869
20870void pd_test_str_len() {
20871    std::cout << "========= Series.str().len() ============================";
20872
20873    pandas::Series<std::string> s({"a", "bb", "ccc", ""});
20874
20875    auto lens = s.str().len();
20876    if (lens[0] != 1 || lens[1] != 2 || lens[2] != 3 || lens[3] != 0) {
20877        std::cout << "  [FAIL] : len() failed" << std::endl;