int wordCount = 1234567890;
WCHAR strWordCount[256] = L"";
wsprintf(strWordCount, L"%d", wordCount);WCHAR strFormatWordCount[256] = L"";
const int splitCount = 3;
const int quotient = wcslen(strWordCount) / splitCount;
const int remainder = wcslen(strWordCount) % splitCount;
int index = 0;
if (remainder > 0)
{
wcsncpy(strFormatWordCount, strWordCount, remainder);
index += remainder;
}
for (int i = 0; i < quotient; ++i)
{
wsprintf(strFormatWordCount + index, L",%s", strWordCount + remainder + (i * splitCount));
index += splitCount + 1; // 1 个逗号
}
strFormatWordCount 便是结果