From e0060f3ff2b431fb53b1138acc1f1d5bd916aef4 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 28 Oct 2002 15:01:32 +0000 Subject: [PATCH] Implemented the last function (ReplaceSet()). Now it's just a matter of doing tests for the remaining functions. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1734 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/support/String.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp index 18d3f78ae8..8c5f390000 100644 --- a/src/kits/support/String.cpp +++ b/src/kits/support/String.cpp @@ -1107,7 +1107,15 @@ BString::ReplaceSet(const char *setOfChars, char with) BString& BString::ReplaceSet(const char *setOfChars, const char *with) { - //TODO: Implement + if (with == NULL) + return *this; //TODO: do something smart + + int32 pos; + int32 withLen = strlen(with); + while ((pos = strcspn(String(), setofChars)) < Length()) { + _OpenAtBy(pos, withLen - 1); + memcpy(_privateData + pos, with, withLen); + } return *this; }