我正在编辑一个文件夹中的文件标题。我想要删除标题中的某一部分,但是用来分隔标题的括号不是标准的ASCII字符,所以我无法找到删除它的方法。这是标题的示例:【删除这一部分】保留这一部分。我已经包含了我使用的编码。我使用一个cstring来存储标题,然后使用cstring::find()来定位这一部分,但是它无法定位到这种类型的括号。
//sets definition
HANDLE hfind;
WIN32_FIND_DATA data;
//creates string for to search for a specific file
CString FileFormat = FolderPath + Format;
CString NewTitle, PulledFile;
//sets definition for retrieving first file
hfind = FindFirstFile(FileFormat, &data);
//runs loop if handle is good
if (hfind != INVALID_HANDLE_VALUE)
{
//loops until it hits the end of the folder
do {
//adds filename to vector
PulledFile = data.cFileName;
if(PulledFile.Find(L'【') != -1)
{
while (PulledFile.Find(L'】') != -1)
{
PulledFile = PulledFile.Right(PulledFile.GetLength() - 1);
}
}
NewTitle = PulledFile.Left(PulledFile.GetLength()-(Format.GetLength() + 9));
if (sizeof(NewTitle) != NULL)
{
v.push_back(NewTitle);
}
} while (FindNextFile(hfind, &data));
}
if (sizeof(NewTitle) != NULL)
非常非常错误。你想用这个比较做什么? - andlabs