我的意思是:比如有字符串"1234ed",加1的结果应为"1234ee",有没有这种的计算方法?大家看清了,不是在后面加上"1"("1234ed1")!!!!!

解决方案 »

  1.   

    把最后一个字符的ASCII码加1就行了;
      

  2.   


    惭愧 没弄过那个Ascii码,要用哪个类?怎么弄?
      

  3.   

    字符转ASCII码:public static int Asc(string character)
      {
       if (character.Length == 1)
       {
        System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
        int intAsciiCode = (int)asciiEncoding.GetBytes(character)[0];
        return (intAsciiCode);
       }
       else
       {
        throw new Exception("Character is not valid.");
       }  }
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zbking/archive/2006/06/22/822040.aspx
      

  4.   

    MessageBox.Show("1234ee".Substring(0, 5) + (char)("1234ee"[5] + 1));  
      

  5.   

    string s="1234ed";
    Console.Write(s.Substring(0,5)+(char)((int)s.ToCharArray()[5] + 1));
      

  6.   

    把字符串转成Int类型,加1然后再转成字符串
      

  7.   

    static string strAdd(string str)
            {
                StringBuilder strS = new StringBuilder(str.Substring(0, str.Length - 1).ToString());            int temp =(int)str[str.Length - 1];
                if (temp <= 122)//z的ASCII值是122
                {
                    temp = temp + 1;
                }
                else
                {
                    //如果字符串最好一个字母为z的处理方式
                }
                strS.Append((char)temp);
                return strS.ToString();
            }
      

  8.   

      class Program
        {
            static void Main(string[] args)
            {
                string a = "1234ed";
                Console.WriteLine(IncreaseAscii(a));//输出1234ee
                Console.ReadKey();
            }
            public static string IncreaseAscii(string character)
            {            System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
                byte[] bs = asciiEncoding.GetBytes(character);
                bs[bs.Length - 1]++;
                return asciiEncoding.GetString(bs);        }
    }