有没有字符串转变量的函数呢?
假设m_Out1为一个EDit的控件变量,并且这些控件N多,少量可以用if直接处理,但是这种方式和代码感觉很繁琐,有没有办法解决呢?
CString str,strValue;
//...处理过程
if (str=="m_Out1") m_Out1 =strValue;
if (str=="m_Out2") m_Out2 =strValue;
if (str=="m_Out3") m_Out3 =strValue;
if (str=="m_Out4") m_Out4 =strValue;
if (str=="m_Out5") m_Out5 =strValue;
if (str=="m_Out6") m_Out6 =strValue;
////////////////////////////////////////////////
如果有一个函数。。。 StrToVal(str)=strValue; 岂不是简洁多了。。。。各位大虾有没有这方面的经验呢?