本文整理汇总了C++中wxString::SetChar方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::SetChar方法的具体用法?C++ wxString::SetChar怎么用?C++ wxString::SetChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::SetChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeLowerAscii
void MakeLowerAscii(wxString& str)
{
for (size_t i = 0; i < str.Len(); i++) {
wxChar c = str.GetChar(i);
if (c >= 'A' && c <= 'Z') {
c += 32;
str.SetChar(i, wxUniChar(c));
}
else if (c == 0x130 || c == 0x131) {
c = 'i';
str.SetChar(i, wxUniChar(c));
}
}
}
示例2: RenameFile
bool RenameFile(wxWindow* parent, wxString dir, wxString from, wxString to)
{
if (dir.Right(1) != _T("\\") && dir.Right(1) != _T("/"))
dir += wxFileName::GetPathSeparator();
#ifdef __WXMSW__
to = to.Left(255);
if ((to.Find('/') != -1) ||
(to.Find('\\') != -1) ||
(to.Find(':') != -1) ||
(to.Find('*') != -1) ||
(to.Find('?') != -1) ||
(to.Find('"') != -1) ||
(to.Find('<') != -1) ||
(to.Find('>') != -1) ||
(to.Find('|') != -1))
{
wxMessageBox(_("Filenames may not contain any of the following characters: / \\ : * ? \" < > |"), _("Invalid filename"), wxICON_EXCLAMATION);
return false;
}
SHFILEOPSTRUCT op;
memset(&op, 0, sizeof(op));
from = dir + from + _T(" ");
from.SetChar(from.Length() - 1, '\0');
op.pFrom = from;
to = dir + to + _T(" ");
to.SetChar(to.Length()-1, '\0');
op.pTo = to;
op.hwnd = (HWND)parent->GetHandle();
op.wFunc = FO_RENAME;
op.fFlags = FOF_ALLOWUNDO;
return SHFileOperation(&op) == 0;
#else
if ((to.Find('/') != -1) ||
(to.Find('*') != -1) ||
(to.Find('?') != -1) ||
(to.Find('<') != -1) ||
(to.Find('>') != -1) ||
(to.Find('|') != -1))
{
wxMessageBox(_("Filenames may not contain any of the following characters: / * ? < > |"), _("Invalid filename"), wxICON_EXCLAMATION);
return false;
}
return wxRename(dir + from, dir + to) == 0;
#endif
}