在VC中字符串怎么反转啊 有没有现成的函数啊

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/4834/4834987.xml?temp=.9893457
      

  2.   

    // compile with: /EHsc
    #include <vector>
    #include <algorithm>
    #include <iostream>int main( ) {
       using namespace std;
       vector <int> v1;
       vector <int>::iterator Iter1;   int i;
       for ( i = 0 ; i <= 9 ; i++ )
       {
          v1.push_back( i );
       }   cout << "The original vector v1 is:\n ( " ;
       for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
          cout << *Iter1 << " ";
       cout << ")." << endl;   // Reverse the elements in the vector 
       reverse (v1.begin( ), v1.end( ) );   cout << "The modified vector v1 with values reversed is:\n ( " ;
       for ( Iter1 = v1.begin( ) ; Iter1 != v1.end( ) ; Iter1++ )
          cout << *Iter1 << " ";
       cout << ")." << endl;
    }
      

  3.   

    int cb=lstrlen(sz);
    int i;
    for(i=0;i<cb/2;i++) sz[i]=sz[cb-i-1];
      

  4.   

    int cb=lstrlen(sz);
    int i;
    char ch;
    for(i=0;i<cb/2;i++) 
    {
     ch=sz[i];
     sz[i]=sz[cb-i-1];
     sz[cb-i-1]=ch;
    }
      

  5.   

    CString strZhuanHuan="zhuanhuandezifuchuan";//需要转换的字符串变量
    CString strZhuanHou="";//转换后的字符串变量
    CString str="";//用来转换的中间变量
    int Len=strZhuanHuan.GetLength();
    for(int i=0;i<Len;i++)
    {
    str=strZhuanHuan.Right(1);
    strZhuanHou+=str;
    }
      

  6.   

    CString str1,str2;
    str2 = str1.MakeReverse()
      

  7.   

    liuqiyc(cyiquil) ( )
     
       CString str1,str2;
       str2 = str1.MakeReverse()
    -----------------------------
    这个要顶
     
     
      

  8.   

    CString str1,str2;
    str2 = str1.MakeReverse()
    ----------------------------
    支持
      

  9.   

    CString str1,str2;
    str2 = str1.MakeReverse()
    ——————————————
    就用这个方法
      

  10.   

    MakeReverse(): Reverses the characters in this string 
      老兄,你的机器上没装MSDN吗?查查CString就OK了,
         网上也有下载的光盘
      

  11.   

    _strrev, _wcsrev, _mbsrev
    Reverse characters of a string.char *_strrev( char *string );wchar_t *_wcsrev( wchar_t *string );unsigned char *_mbsrev( unsigned char *string );