private void button2_Click(object sender, EventArgs e)
        {//去掉字符串头尾指定字符
            string MyInfo= "--中华人民共和国--";
            //显示 "中华人民共和国"
            MessageBox.Show(MyInfo.Trim(new char[1] { '-' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);           
            MyInfo = ",-中华人民共和国-,-";
            //显示 "中华人民共和国"
            MessageBox.Show(MyInfo.Trim(new char[2] { '-', ',' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                       
            MyInfo = "--中华人民共和国--";
            //显示 "中华人民共和国--"
            MessageBox.Show(MyInfo.TrimStart(new char[1] { '-' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                       
            MyInfo = ",-中华人民共和国-,-";
            //显示 "中华人民共和国-,-"
            MessageBox.Show(MyInfo.TrimStart(new char[2] { '-', ',' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                       
            MyInfo = "--中华人民共和国--";
            //显示 "--中华人民共和国"
            MessageBox.Show(MyInfo.TrimEnd(new char[1] { '-' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                       
            MyInfo = ",-中华人民共和国-,-";
            //显示 ",-中华人民共和国"
            MessageBox.Show(MyInfo.TrimEnd(new char[2] { '-', ',' }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                       
        }

最新文章

  1. juqery 正则表达式的使用
  2. 【Swift】UILabel 设置内边距
  3. Java Mybatis 框架入门教程
  4. PullToRefreshGridView刷新加载
  5. PHP变量在内存中的存储方式
  6. STL--迭代器(iterator)
  7. Java Map 按Key排序和按Value排序
  8. JavaWeb基础: Tomcat
  9. 可清空文本的EditText
  10. http协言和web本质
  11. Android推断程序前后台状态
  12. Intent的属性及Intent-filter配置——Component属性
  13. OC比C中,新增的数据类型
  14. SQL优化实用方法
  15. IT咨询顾问:一次吐血的项目救火
  16. javascript对内容的操作
  17. 【未解决】centos 6.4 xen4.2 在关机的时候很慢
  18. 关于0xFFFFFFFF和alpha,温故而知新
  19. tomcat 在liunx中shutdown后进程仍然存在的两种实用解决办法
  20. MySQL多表数据记录查询详解

热门文章

  1. Elixir游戏服设计六
  2. Tensorflow卷积神经网络
  3. HDU2048 HDU2049 组合数系列 错排
  4. Javascript之pixi框架学习
  5. C# 基础之类型(一)
  6. PHP常用表达式用法
  7. C# 相对路径转绝对路径
  8. Latex 论文elsevier,手把手如何用Latex写论文
  9. 关于scanf 与 cin gets(),getline()......输入输出字符串的区别
  10. Traefik实现Kubernetes集群服务外部https访问