c#大小字母写传化

学c语言的时候就知道第2将里面专门介绍了大小写字母传化 而也有人问过 大多数都是用的微软封装好的方法.

下面参照c语言的改写的 不考虑性能和扩展性好不好 只是一个娱乐而已。

           string str = "HELLOWORD";

            Console.WriteLine(str.ToLower());

            byte[] array = Encoding.ASCII.GetBytes(str);
            byte[] aa = new byte [100];
            string ascii=string.Empty;
            for (int i = 0; i < array.Length; i++)
            {
                int ss = array[i] + 32;
                aa = BitConverter.GetBytes(ss);
                ascii+=  Encoding.ASCII.GetString(aa);
            }
            Console.WriteLine(ascii.Replace("\0",""));

  

原文地址:https://www.cnblogs.com/y112102/p/2892951.html