本文介绍了如何从MFC的EditBox中输入的文本中获取字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从MFC的EditBox中输入的文本中分别获取字符.

例如,我用"Hello World"填充了editbox变量.现在我想按字符获取字符,例如,首先是"H",然后是"E",然后是"L",然后是"L",然后是"O"?

How to get the characters individually from a text entered in the EditBox in MFC.

For Example, I populated the editbox variable with "Hello World". Now I want to get the Character by character i.e First ''H'', then ''E'', then ''L'', then ''L'', then ''O'' like that?

推荐答案

 char  CEdit::GetCharByIndex(int nIndex)
{
  CString  wndText;
  GetWindowText(wndText);

  ASSERT ( nIndex < wndText.GetLength() );

  return ( wndText.GetAt(nIndex) );
}

我的头顶. YMMV. :)

That''s all off the top of my head. YMMV. :)


这篇关于如何从MFC的EditBox中输入的文本中获取字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-28 00:16