제목 작업을 수행하려고하지만 내 코드가 나뉘 지 않습니다.wstring을 사용하여 C++ 분리 유니 코드 구분 문자열
#define SQL_TEXT Latin_Text
#include <iostream>
#define SQL_TEXT Latin_Text
#include <sqltypes_td.h>
#include "Split.h"
#include <string>
#include <stdio.h>
#include <vector>
#include <cstring>
using namespace std;
int main()
{
VARCHAR_LATIN *result = new VARCHAR_LATIN[512];
wchar_t *s1 = (wchar_t *)"Myýnameýisýzeeshan";
**splitstringwc s(s1);
vector<wstring> flds = s.splitwc((wchar_t)'ý');**
wstring rs = flds[1];
wcout<<rs<<endl;
for (int k = 0; k < flds.size(); k++)
cout << k << " => " << flds[k].data() << endl;
cout<<result;
return 0;
}
은 다음과 splitstringwc 클래스의 코드가 될 때 :
public:
splitstringwc(wchar_t *s) : wstring(s) { };
vector<wstring>& splitwc(wchar_t delim, int rep=0);
};
vector<wstring>& splitstringwc::splitwc(wchar_t delim, int rep) {
if (!flds1.empty()) flds1.clear(); // empty vector if necessary
wstring ws = data();
wcout<<ws<<endl;
//wcout<<delim<<endl;
//wstring ws;
//int j = StringToWString(ws, work);
wstring buf = (wchar_t *)"";
int i = 0;
while (i < ws.size()) {
if (ws.at(i) != delim)
buf += ws.at(i);
else if (rep == 1) {
flds1.push_back(buf);
buf = (wchar_t *)"";
} else if (buf.size() > 0) {
flds1.push_back(buf);
buf = (wchar_t *)"";
}
i++;
}
if (!buf.empty())
flds1.push_back(buf);
return flds1;
}
코드 나던 내가 디버그하려고 할 때, 내가 얻을, 입력 문자열을 분할 다음은 주요 기능입니다 세분화 오류 : wstring ws = data(); 넓은 문자열을 처리 할 때
도와주세요 ...............
관련 : http://www.joelonsoftware.com/articles/Unicode.html, –