Theide:minor fixes, Core: WString Filter(WString variants

git-svn-id: svn://ultimatepp.org/upp/trunk@1242 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-05-27 18:06:19 +00:00
parent 332216abd6
commit 2cbfc8721e
3 changed files with 25 additions and 1 deletions

View file

@ -114,4 +114,25 @@ String FilterWhile(const char *s, int (*filter)(int))
return result;
}
WString Filter(const wchar *s, int (*filter)(int))
{
String result;
while(*s) {
int c = (*filter)((byte)*s++);
if(c) result.Cat(c);
}
return result;
}
WString FilterWhile(const wchar *s, int (*filter)(int))
{
String result;
while(*s) {
int c = (*filter)((byte)*s++);
if(!c) break;
result.Cat(c);
}
return result;
}
END_UPP_NAMESPACE

View file

@ -787,4 +787,7 @@ int CharFilterNoCrLf(int c);
String Filter(const char *s, int (*filter)(int));
String FilterWhile(const char *s, int (*filter)(int));
WString Filter(const wchar *s, int (*filter)(int));
WString FilterWhile(const wchar *s, int (*filter)(int));
#include "AString.hpp"