diff options
Diffstat (limited to 'Source/Library')
-rw-r--r-- | Source/Library/Common/BasicString.class.cpp | 1 | ||||
-rw-r--r-- | Source/Library/Common/BasicString.class.h | 2 | ||||
-rw-r--r-- | Source/Library/Common/String.class.cpp | 1 | ||||
-rw-r--r-- | Source/Library/Common/String.class.h | 2 |
4 files changed, 4 insertions, 2 deletions
diff --git a/Source/Library/Common/BasicString.class.cpp b/Source/Library/Common/BasicString.class.cpp index f3a6164..58fa926 100644 --- a/Source/Library/Common/BasicString.class.cpp +++ b/Source/Library/Common/BasicString.class.cpp @@ -175,6 +175,7 @@ Vector< BasicString<T> > BasicString<T>::split(T sep) const { template <typename T> BasicString<T> BasicString<T>::substr(s32int start, u32int size) { if (start < 0) start = m_length - start; + if (size == 0) size = m_length - start; BasicString<T> ret; ret.m_string = new T[size + 1]; ret.m_length = size; diff --git a/Source/Library/Common/BasicString.class.h b/Source/Library/Common/BasicString.class.h index 21041e8..be74cf3 100644 --- a/Source/Library/Common/BasicString.class.h +++ b/Source/Library/Common/BasicString.class.h @@ -46,7 +46,7 @@ class BasicString { bool contains(const T& chr) const; Vector< BasicString<T> > split(T sep) const; - BasicString<T> substr(s32int start, u32int size); + BasicString<T> substr(s32int start, u32int size = 0); }; #include "BasicString.class.cpp" diff --git a/Source/Library/Common/String.class.cpp b/Source/Library/Common/String.class.cpp index a824eac..da2b93e 100644 --- a/Source/Library/Common/String.class.cpp +++ b/Source/Library/Common/String.class.cpp @@ -193,6 +193,7 @@ Vector<String> String::split(WChar c) const { String String::substr(s32int start, u32int size) { if (start < 0) start = m_length - start; + if (size == 0) size = m_length - start; String ret; ret.m_string = new WChar[size + 1]; ret.m_length = size; diff --git a/Source/Library/Common/String.class.h b/Source/Library/Common/String.class.h index 0d48ce6..473624b 100644 --- a/Source/Library/Common/String.class.h +++ b/Source/Library/Common/String.class.h @@ -43,7 +43,7 @@ class String : public BasicString<WChar> { Vector<String> split(WChar c) const; - String substr(s32int start, u32int size); + String substr(s32int start, u32int size = 0); }; #endif |