diff --git a/include/pocketpy/str.h b/include/pocketpy/str.h index 8f78d98f..6bf518a0 100644 --- a/include/pocketpy/str.h +++ b/include/pocketpy/str.h @@ -73,7 +73,7 @@ struct Str{ Str escape(bool single_quote=true) const; int index(const Str& sub, int start=0) const; Str replace(const Str& old, const Str& new_, int count=-1) const; - std::vector split(Str sep) const; + std::vector split(const Str& sep) const; /*************unicode*************/ int _unicode_index_to_byte(int i) const; diff --git a/src/str.cpp b/src/str.cpp index 264f1f73..327be002 100644 --- a/src/str.cpp +++ b/src/str.cpp @@ -308,7 +308,7 @@ int utf8len(unsigned char c, bool suppress){ return _byte_index_to_unicode(size); } - std::vector Str::split(Str sep) const{ + std::vector Str::split(const Str& sep) const{ std::vector result; int start = 0; while(true){