From dc55c64d0d7fef87fce72c272d02f874efff4397 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 12 Apr 2022 19:10:20 +0200 Subject: Added concat method to Text that does not mutate base --- FoundationEx/Text.cpp | 8 ++++++++ FoundationEx/Text.h | 1 + 2 files changed, 9 insertions(+) (limited to 'FoundationEx') diff --git a/FoundationEx/Text.cpp b/FoundationEx/Text.cpp index ac86d5e..442a048 100644 --- a/FoundationEx/Text.cpp +++ b/FoundationEx/Text.cpp @@ -658,6 +658,14 @@ Text::replace(const char* pattern, const char* substitution) } Text +Text::concat(const char* tail) const +{ + Text result(*this); + result.append(tail); + return result; +} + +Text Text::format(const char* fmt, ...) { char buf[2048]; diff --git a/FoundationEx/Text.h b/FoundationEx/Text.h index b498689..37e5842 100644 --- a/FoundationEx/Text.h +++ b/FoundationEx/Text.h @@ -125,6 +125,7 @@ public: Text substring(int start, int length); Text trim(); Text replace(const char* pattern, const char* substitution); + Text concat(const char* tail) const; static Text format(const char* fmt, ...); private: -- cgit v1.1