//这个是用来修改姓氏多音字的
//name 是名字 szSpell 是拼音
CString ChangeSpell(LPCSTR name,CString szSpell)
{
//修改用拼音
CString pinyin = "";
//第一个字的拼音
CString tmp;
// 查找第一个空格的位置
int pos = szSpell.Find(_T(" "));
if (pos != -1) {
tmp = szSpell.Mid(0, pos);// 取出第一个单词
}
//第一个字符
// LPCSTR转char*
char* str = const_cast<char*>(name);
//取汉字
char val[3] = { 0 };
strncpy(val, str, 2);
// 比较val与字符串的值
if (strcmp(val, "覃") == 0) pinyin="Qin";
if (strcmp(val, "瞿") == 0) pinyin="Qu";
if (strcmp(val, "翟") == 0) pinyin="Zhai";
if (strcmp(val, "查") == 0) pinyin="Zha";
if (strcmp(val, "曾") == 0) pinyin="Zeng";
if (strcmp(val, "乐") == 0) pinyin="Yue";
if
vc++6.0中mfc项目,汉字字符串分割和判断
于 2023-05-10 11:06:16 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)