File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 99 * string::split(string token)
1010 * string::toLowerCase()
1111 * string::toUpperCase()
12+ *
13+ * To allow selecting indexes from split(), ensure VectorString type is added:
14+ *
15+ * chai.add(chaiscript::bootstrap::standard_library::vector_type<std::vector<std::string>>("VectorString"));
1216 */
1317#include < algorithm>
1418#include < string>
@@ -21,9 +25,6 @@ namespace chaiscript {
2125 namespace string_methods {
2226 ModulePtr bootstrap (ModulePtr m = std::make_shared<Module>())
2327 {
24- // Add lists of strings.
25- m->add (bootstrap::standard_library::vector_type<std::vector<std::string>>(" StringVector" ));
26-
2728 // string::replace(std::string search, std::string replace)
2829 m->add (fun ([](const std::string& subject, const std::string& search, const std::string& replace) {
2930 std::string result (subject);
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ TEST_CASE( "string_methods functions work", "[string_methods]" ) {
1212
1313 // Add the string_methods module.
1414 auto stringmethods = chaiscript::extras::string_methods::bootstrap ();
15+ chai.add (chaiscript::bootstrap::standard_library::vector_type<std::vector<std::string>>(" StringVector" ));
1516 chai.add (stringmethods);
1617
1718 // replace(string, string)
@@ -31,4 +32,4 @@ TEST_CASE( "string_methods functions work", "[string_methods]" ) {
3132
3233 // toUpperCase()
3334 CHECK (chai.eval <std::string>(" \" Hello World!\" .toUpperCase()" ) == " HELLO WORLD!" );
34- }
35+ }
You can’t perform that action at this time.
0 commit comments