mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
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:
parent
332216abd6
commit
2cbfc8721e
3 changed files with 25 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue