请问怎样获取字符串里的某一个字符

MANUB 2007-09-08 02:45:20
我在做两个字符串的匹配,例如CString str="A123我";怎样可以获取到"我"字
...全文
145 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
MANUB 2007-09-08
  • 打赏
  • 举报
回复
这样行了,谢谢你了,你到"请教一个在VC2005上运行的问题 "这个问题上留个言吧,我给分你
livedeal 2007-09-08
  • 打赏
  • 举报
回复
CString str1;
str1.Format(_T("%s"),DisplayName_Get);
int nIndex=m_ListProgram.InsertItem(m_ListProgram.GetItemCount(),str1);
这样呢~????
MANUB 2007-09-08
  • 打赏
  • 举报
回复
结果还是跟原来一样,乱码
livedeal 2007-09-08
  • 打赏
  • 举报
回复
MultiByteToWideChar (CP_ACP, 0, (LPCSTR)DisplayName_Get, -1, NULL, 0);
MANUB 2007-09-08
  • 打赏
  • 举报
回复
“MultiByteToWideChar”: 不能将参数 3 从“LPBYTE”转换为“LPCSTR”
livedeal 2007-09-08
  • 打赏
  • 举报
回复
DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, DisplayName_Get, -1, NULL, 0);
CString str1=CString(DisplayName_Get);
int nIndex=m_ListProgram.InsertItem(m_ListProgram.GetItemCount(),str1);
这样试试!!!
livedeal 2007-09-08
  • 打赏
  • 举报
回复
DisplayName_Get不是UNICODE的关系吧```
MANUB 2007-09-08
  • 打赏
  • 举报
回复
谢了,这个问题现在给分,livedeal(怀念)可以再帮我看看一个问题吗,另外给分
LPBYTE DisplayName_Get=new BYTE[80];
DWORD type1=REG_SZ;
DWORD cbData1=80;
long ret2=::RegQueryValueEx(hkey_,_T("DisplayName"),NULL,&type1,DisplayName_Get,&cbData1);
if(ret2==ERROR_SUCCESS)
{
CString str1=CString(DisplayName_Get);
int nIndex=m_ListProgram.InsertItem(m_ListProgram.GetItemCount(),str1);
}
在VC6运行正确,但在2005里List显示是乱码
livedeal 2007-09-08
  • 打赏
  • 举报
回复
CString str1="as我在ss";
CString str2="我在";
int a=str1.Find(str2);
if(a>=0)
{
int c=str1.GetLength();
str2=str1.Right(c-a);
}
MANUB 2007-09-08
  • 打赏
  • 举报
回复
我是想这样,有两个字符串
CString str1="as我在ss";
CString str2="我在";
匹配之后,将"我在"以及之后的字符提取出来,得到另一个字符串"我在ss"
zaodt 2007-09-08
  • 打赏
  • 举报
回复

CString s( "abcdef" );
ASSERT( s.Find( "de" ) == 3 );
livedeal 2007-09-08
  • 打赏
  • 举报
回复
CString::Find
MANUB 2007-09-08
  • 打赏
  • 举报
回复
有没有函数可以将两个字符串进行匹配

2,586

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧