直接的函数好像是没有的 你可以找到‘|’ 来把  str分离的啊   操作还是比较简单的

解决方案 »

  1.   

    CString str="acx|bxd|yzs|pes"; 
          char *csInput; csInput=str.GetBuffer(str.GetLength()); //提取字符串,把单词存放在数组csInput中 
    char seps[]= "|";                              //字符串以|为分隔符 
            char *token; token = strtok( csInput, seps ); 
    index=0;          //全局变量 
          while( token != NULL )                    //把提取到的单词存放到数组csEditIput中 
            { 
                csEditInput[index]=token;                /* 把单词存放在数组csEditInput中" */ 
        index++; 
                token = strtok( NULL, seps );          /* Get next token: */ 
            }
      

  2.   

    谢谢.好象有问题.打印 token出来,acx没了.只有后面三位.
      

  3.   

    应该没有问题的,测试通过了的,你再试一下或者你去看看MSDN
      

  4.   

    char string[] = "A string\tof ,,tokens\nand some  more tokens";
    char seps[]   = " ,\t\n";
    char *token;void main( void )
    {
       printf( "%s\n\nTokens:\n", string );
       /* Establish string and get the first token: */
       token = strtok( string, seps );
       while( token != NULL )
       {
          /* While there are tokens in "string" */
          printf( " %s\n", token );
          /* Get next token: */
          token = strtok( NULL, seps );
       }
    }
      

  5.   

    直接用未公开的windows api函数...AfxExtractSubString(str,strFull,0,"|") 将第一组字符保存于str中...
      

  6.   

    CString str,strtemp;
    str = "acx|bxd|yzs|pes";
    int b = 0;
    while( -1 != str.Find('|'))
    {
    str.Remove('|');
    }
    MessageBox(str);
    str.GetAt()
    len = str.Getlen()
    然后就可以使用了。
      

  7.   

    要求生成数组,感觉用7楼的那个API函数和CString操作可以简化到一定程度,再简单的方式应该是没有,无论怎样都需10行左右代码实现。
      

  8.   

    CString有个成员函数Tokenize, 可以实现
      

  9.   

    又查了一遍函数说明,原来AfxExtractSubString可以很简单地用,只需一行参数定义,一行循环语句即可完成楼主的目标。  注意最后一个参数只能是单个字符做分隔符,用单引号。
    ---------------------------------------------------
    CString str=_T("acx|bxd|yzs|pes"),mArray[4];//定义源字符串&分割字符串数组   for(int i=0;i<4;i++) AfxExtractSubString(mArray[i],str,i,',');  //将分割结果存放在数组中