CString buf="a:bcda:43a:a:89097a:";
我想获取每个字符a:的位置 怎么处理谢谢!!

解决方案 »

  1.   

    // First example demonstrating 
    // CString::Find ( TCHAR ch )
    CString s( "abcdef" );
    ASSERT( s.Find( 'c' ) == 2 );
    ASSERT( s.Find( "de" ) == 3 );// Second example demonstrating 
    // CString::Find( TCHAR ch, int nStart )
    CString str("The stars are aligned");
    int n = str.Find('e', 5);
    ASSERT(n == 12);---------------------------------------
    摘自MSDN如果是char* 类型的话用  strchr
      

  2.   

    int i = buf.find("a:",0);
    while(i != -1)
    {
      //save
      i = buf.find("a:",i+1);
    }
      

  3.   

    楼上的就可一用了 
    find();//第一个参数 为查找的字符;第二个是索引;
      

  4.   

    cstring str1="ajdfjlkdfajldfsaklsdjf";
    while (int(str1.Find("/"))!=-1)
    { int index=CSParameter1.Find("a");
    ......//index存了位置,可以取出操作
    }
      

  5.   

    错了
    cstring str1="ajdfjlkdfajldfsaklsdjf";
    while (int(str1.Find("/"))!=-1)
    {int index=str1.Find("a");
    ......//index存了位置,可以取出操作
    }
      

  6.   

    还有别的方法没有 把WHILE放进去 程序就死了