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 9
9
* string::split(string token)
10
10
* string::toLowerCase()
11
11
* 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"));
12
16
*/
13
17
#include < algorithm>
14
18
#include < string>
@@ -21,9 +25,6 @@ namespace chaiscript {
21
25
namespace string_methods {
22
26
ModulePtr bootstrap (ModulePtr m = std::make_shared<Module>())
23
27
{
24
- // Add lists of strings.
25
- m->add (bootstrap::standard_library::vector_type<std::vector<std::string>>(" StringVector" ));
26
-
27
28
// string::replace(std::string search, std::string replace)
28
29
m->add (fun ([](const std::string& subject, const std::string& search, const std::string& replace) {
29
30
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]" ) {
12
12
13
13
// Add the string_methods module.
14
14
auto stringmethods = chaiscript::extras::string_methods::bootstrap ();
15
+ chai.add (chaiscript::bootstrap::standard_library::vector_type<std::vector<std::string>>(" StringVector" ));
15
16
chai.add (stringmethods);
16
17
17
18
// replace(string, string)
@@ -31,4 +32,4 @@ TEST_CASE( "string_methods functions work", "[string_methods]" ) {
31
32
32
33
// toUpperCase()
33
34
CHECK (chai.eval <std::string>(" \" Hello World!\" .toUpperCase()" ) == " HELLO WORLD!" );
34
- }
35
+ }
You can’t perform that action at this time.
0 commit comments