Commit 3c609fbe authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

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

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62607 954022d7-b5bf-4e40-9824-e11837661b57
parent c9c9ed4f
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#define _BUILD_STRING_CROSSPLATFORM_H_ #define _BUILD_STRING_CROSSPLATFORM_H_
#include "CPEncodings/CodePage.h" #include "CPEncodings/CodePage.h"
#include <vector>
#include <sstream>
namespace NSString namespace NSString
{ {
...@@ -178,6 +180,23 @@ namespace NSString ...@@ -178,6 +180,23 @@ namespace NSString
return sRet; 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_ #endif // _BUILD_STRING_CROSSPLATFORM_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment