TextAdjustment ============== .. cpp:class:: pandas::TextAdjustment pandas C++ class. Example ------- .. code-block:: cpp #include using namespace pandas; // Use TextAdjustment TextAdjustment obj; // ... operations ... Comparison ---------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``virtual size_t len(const std::string& s) const`` - virtual size_t - pd_text_adjust.h:16 - :ref:`View ` Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``virtual std::vector justify( const std::vector& strings, size_t max_len, std::string_view mode) const`` - virtual std::vector - pd_text_adjust.h:22 - Code Examples ------------- The following examples are extracted from the test suite. .. _example-textadjustment-len-0: .. dropdown:: len (pd_test_3_all.cpp:20867) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 20857 :emphasize-lines: 11 auto title_result = s.str().title(); if (title_result[0] != "Hello World" || title_result[1] != "Hello World" || title_result[2] != "Hello World") { std::cout << " [FAIL] : title() failed" << std::endl; throw std::runtime_error("pd_test_str_capitalize_title: title() failed"); } std::cout << " -> tests passed" << std::endl; } // ============================================================================ // Test str().len() // ============================================================================ void pd_test_str_len() { std::cout << "========= Series.str().len() ============================"; pandas::Series s({"a", "bb", "ccc", ""}); auto lens = s.str().len(); if (lens[0] != 1 || lens[1] != 2 || lens[2] != 3 || lens[3] != 0) { std::cout << " [FAIL] : len() failed" << std::endl;