mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: new Split variant with String delimiter
git-svn-id: svn://ultimatepp.org/upp/trunk@1645 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
fc03d51e52
commit
a7bdca3453
3 changed files with 20 additions and 1 deletions
|
|
@ -866,7 +866,7 @@ frFR("")
|
|||
huHU("Az időpont a köv. kettő között legyen: ")
|
||||
itIT("")
|
||||
nlNL("Tijd moet vanaf ")
|
||||
plPL("")
|
||||
plPL("Czas musi być z zakresu ")
|
||||
roRO("Ora trebuie să fie în intervalul ")
|
||||
ruRU("Время должно быть в интервале")
|
||||
skSK("Čas musí byť v rozsahu ")
|
||||
|
|
|
|||
|
|
@ -304,6 +304,24 @@ Vector<String> Split(const char *s, int chr, bool ignoreempty) {
|
|||
return Split(s, ct, ignoreempty);
|
||||
}
|
||||
|
||||
struct StringSplit : TextTest {
|
||||
String test;
|
||||
|
||||
virtual const char *Accept(const char *s) const {
|
||||
int l = test.GetCount();
|
||||
if(l && memcmp(~test, s, l) == 0)
|
||||
return s + l;
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
Vector<String> Split(const char *s, const String& delim, bool ignoreempty)
|
||||
{
|
||||
StringSplit ss;
|
||||
ss.test = delim;
|
||||
return Split(s, ss, ignoreempty);
|
||||
}
|
||||
|
||||
String Join(const Vector<String>& im, const String& delim) {
|
||||
String r;
|
||||
for(int i = 0; i < im.GetCount(); i++) {
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ public:
|
|||
Vector<String> Split(const char *s, const TextTest& delim, bool ignoreempty = true);
|
||||
Vector<String> Split(const char *s, int (*filter)(int), bool ignoreempty = true);
|
||||
Vector<String> Split(const char *s, int chr, bool ignoreempty = true);
|
||||
Vector<String> Split(const char *s, const String& delim, bool ignoreempty = true);
|
||||
String Join(const Vector<String>& im, const String& delim);
|
||||
|
||||
WString Join(const Vector<WString>& im, const WString& delim);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue