正文

自己收集整理琢磨的一些好的算法2006-07-18 15:49:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/Csharpsky/16661.html

分享到:

//byte[] sby = System.Text.Encoding.Unicode.GetBytes("宁绍");        //string str = "";        //for (int i = 0; i < sby.Length; i++)        //{        //    str += sby[i].ToString() + ",";        //}        //Label1.Text = str;        // String a = "159343536267578990074874";       //  String  a1="";       //  char temp;       //int b = a.Length;       //char[] c = a.ToCharArray();       //for(int i=0;i<b;i++)        // for (int j=0;j<b-i-1 ; j++)       // {       // if (c[j]>=c[j+1])       // {       //  temp = c[j];       //  c[j] = c[j+1];       //  c[j+1] = temp;        // }       // }       // for(int k=0;k<b;k++)       //{       //  this.Label1.Text=c[k].ToString()+",";       //}        //string str = "Hello";        //string strRev = "";        //char[] se = str.ToCharArray();        //int len = se.Length;        ////se=(char[])Array.Reverse(se);        //for (int i = len - 1; i >= 0; i--)        //{        //    strRev += se[i].ToString();        //}        ////string strRev = new string();         //this.Label1.Text = strRev;         //string str = "Hello你好";               //char[] se = str.ToCharArray();                //Array.Reverse(se);        //string strRev = new string(se);        //decimal strRev = 'a'/ 'b';        ////strRev = 127 / 2;        //this.Label1.Text = strRev.ToString();        // reserve();   private void reserve()    {        string str = "a";            //System.Collections.Generic.Stack<char> cStack = new System.Collections.Generic.Stack<char>(str);             //while (cStack.Count > 0)            //{            //    this.Label1.Text += cStack.Pop().ToString();            //}        //System.Text.StringBuilder str = new System.Text.StringBuilder("hello");        // char temp;        // for (int i = 0; i < str.Length / 2; i++)        // {        //     temp = str[i];        //     str[i] = str[str.Length - 1 - i];        //     str[str.Length - 1 - i] = temp;        // }        // this.Label1.Text = str.ToString();        if (str == null)        {            return ;        }        if (str.Length == 0)        {            return ;        }         char[] data = str.ToCharArray();        int iLeft = 0;        int iRight = data.Length - 1;        while (true)        {            if (iRight >= 0 && iLeft < iRight)            {                char temp = data[iLeft];                data[iLeft] = data[iRight];                data[iRight] = temp;            }            else            {                break;            }            iLeft++;            iRight--;        }        String newStr = new String(data);        this.Label1.Text = newStr;             }

阅读(1942) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册