自学内容网 自学内容网

String、StringBuilder

  internal class Mainclus
  {
      internal static void Main(string[] args)
      {
          //创建方式
          string a = "*world";
          string new1 = "hello*world";
          string new2 = "hello" + "*world";
          string new3 = new string(new char[] { 'h', 'e', 'l', 'l', 'o', '*', 'w', 'o', 'r', 'l', 'd' });
          string new4 = "hello" + a;
          Console.WriteLine(new3);

          //属性
          Console.WriteLine(new1.Length);

          //索引器,string中对[int index]已经做了定义.
          Console.WriteLine(new1[2]);

          //比较,==比较字符串的内容是否相等,在string中也是对=


原文地址:https://blog.csdn.net/m0_69089705/article/details/142717700

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!