From 8dd6d33a6d1a127eff9e4817044a272ea1ef0273 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 20 Jan 2013 23:28:12 +0000 Subject: [PATCH] base: implement String::Resize(). --- src/lol/base/string.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lol/base/string.h b/src/lol/base/string.h index 172354b7..67f8a959 100644 --- a/src/lol/base/string.h +++ b/src/lol/base/string.h @@ -64,6 +64,12 @@ public: return ((Super const &)*this).Count() - 1; } + void Resize(int count) + { + ((Super &)*this).Resize(count + 1); + ((Super &)*this).Last() = '\0'; + } + inline String operator +(String const &s) const { String ret(*this); @@ -72,7 +78,7 @@ public: inline String& operator +=(String const &s) { - /* Be careful, we have a trailing zero we don't want! */ + /* Ignore the trailing zero we don't want */ --m_count; (Super &)*this += (Super const &)s; return *this;