本文整理汇总了C++中wstring::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::insert方法的具体用法?C++ wstring::insert怎么用?C++ wstring::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReplaceAll
void StringUtilities::ReplaceAll(wstring &str, const wstring &search, const wstring &replace)
{
for (size_t pos = 0;; pos += replace.length() - 1)
{
pos = str.find(search, pos);
if (pos == string::npos) break;
str.erase(pos, search.length());
str.insert(pos, replace);
}
}
示例2: getBestSentence
unsigned CIMIContext::getBestSentence (wstring& result, unsigned start, unsigned end)
{
result.clear();
if (UINT_MAX == end) end = m_tailIdx - 1;
while (end > start && m_lattice[end].m_bwType == CLatticeFrame::NO_BESTWORD)
end --;
unsigned i = end, nWordConverted = 0;
while (i > start) {
CLatticeFrame &fr = m_lattice[i];
result.insert (0, fr.m_bestWord.m_cwstr);
i = fr.m_bestWord.m_start;
nWordConverted ++;
}
return nWordConverted;
}
示例3: Launch
size_t Launch(wstring exe, wstring params) {
if (params.size() != 0 && params[0] != L' ') {
params.insert(0, L" ");
}
size_t ret = 0, lastSlash = 0;
DWORD exitCode = 0;
wstring temp = L"";
wchar_t* paramCopy = new wchar_t[params.size() + 1];
if (paramCopy == 0)
return 1;
const wchar_t* transfer = params.c_str();
wcscpy_s(paramCopy, params.size() + 1, transfer);
STARTUPINFOW startup;
PROCESS_INFORMATION process;
memset(&startup, 0, sizeof(startup));
memset(&process, 0, sizeof(process));
startup.cb = sizeof(startup);
if (CreateProcessW(const_cast<LPCWSTR>(exe.c_str()), paramCopy, 0, 0, false,
CREATE_NO_WINDOW, 0, 0, &startup, &process) != false) {
exitCode = WaitForSingleObject(process.hProcess, 1000);
} else {
ret = GetLastError();
}
delete[]paramCopy;
paramCopy = 0;
CloseHandle(process.hProcess);
CloseHandle(process.hThread);
return ret;
}
示例4: PadChar
wstring PadChar(wstring str, const wchar_t ch, const size_t len) {
if (len > str.length())
str.insert(0, len - str.length(), ch);
return str;
}