You can use the operator []
. This returns a wchar
, not a string, but it seems to me this will make your code simpler. So to make things clearer:
for (int i=0;i<wsInput.size();i++)
{
wchar_t wc =wsInput[i]; // sorry for the name it comes from wchar ;)
... do stuff...
}
EDIT: to get a wstring consisting of the i-th character in the string use substr
:
for (int i=0;i<wsInput.size();i++)
{
wstring ws = wsInput.substr(i, 1);
... do stuff...
}