Добавлена функция Split для страндартных стрингов std::wstring.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62607 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Ilya.Kirillov
2015-05-18 14:44:59 +00:00
committed by Alexander Trofimov
parent c9c9ed4f90
commit 3c609fbe83

View File

@ -2,6 +2,8 @@
#define _BUILD_STRING_CROSSPLATFORM_H_
#include "CPEncodings/CodePage.h"
#include <vector>
#include <sstream>
namespace NSString
{
@ -178,6 +180,23 @@ namespace NSString
return sRet;
}
};
static std::vector<std::wstring>& Split(const std::wstring& wsString, wchar_t nDelim, std::vector<std::wstring> &arrElements)
{
std::wstringstream wStringStream(wsString);
std::wstring wsItem;
while (std::getline(wStringStream, wsItem, nDelim))
{
arrElements.push_back(wsItem);
}
return arrElements;
}
static std::vector<std::wstring> Split(const std::wstring& wsString, wchar_t nDelim)
{
std::vector<std::wstring> wsElements;
Split(wsString, nDelim, wsElements);
return wsElements;
}
};
#endif // _BUILD_STRING_CROSSPLATFORM_H_