当前位置: 首页 > news >正文

昆山网站公司wordpress手机端显示分类

昆山网站公司,wordpress手机端显示分类,郑州做网站首选九零后网络,淘宝网站的建设目的是什么ToUpper()/ToLower() 作用#xff1a;将字符串中字符转换为大写/小写字符#xff0c;仅对字符有效#xff0c;返回转换后的字符串。 使用#xff1a;字符串变量名.ToUpper() / 字符串变量名.ToLower() 使用实例如下#xff1a; using System; using System.Collection…ToUpper()/ToLower() 作用将字符串中字符转换为大写/小写字符仅对字符有效返回转换后的字符串。 使用字符串变量名.ToUpper() / 字符串变量名.ToLower() 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s abcDE123;Console.WriteLine(s.ToUpper());Console.WriteLine(s.ToLower());Console.ReadKey();}} } 输出结果 ABCDE123 abcde123 Equals() 作用比较两字符串是否相同是则返回真否则返回假。 使用字符串1.Equals(字符串2) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s1, s2, s3;s1 12345;s2 12345;s3 l2345;Console.WriteLine(s1.Equals(s2));Console.WriteLine(s2.Equals(s3));Console.ReadKey();}} } s1与s2中内容均为12345而s3中首字符为英文小写字母ls1、s2相同s3与s1、s2不相同则输出结果为 True False Split() 作用根据所选择的字符对字符串分割返回字符串类型的数组。 使用将分割的字符串.Split(用于分割的字符数组) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 111,22,3333.4,555;char[] c new char[2] { ,, . };string[] sArray s.Split(c);foreach(string strIter in sArray){Console.WriteLine(strIter);}Console.ReadKey();}} } Split根据字符,与.将字符串s分割后依次存入字符串数组sArray最后输出结果为 111 22 3333 4 555 Substring() 作用从某一下标开始截取字符串返回截取后的字符串。 使用被截取的字符串.Substring(截取起点索引值[,截取字符串长度]) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 1234567;Console.WriteLine(s.Substring(1));Console.WriteLine(s.Substring(1,4));Console.ReadKey();}} } 第一次截取从索引值为1的位置开始截取至字符串结束第二次截取从索引值为1的位置开始截取4个字符长度的字符串。输出结果如下 234567 2345 IndexOf()/LastIndexOf() 作用查找子字符串在字符串中第一次/最后一次出现位置索引如果未找到返回-1。 使用字符串.IndexOf(查找的子字符串)/字符串.LastIndexOf(查找的子字符串) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 12345671234567;Console.WriteLine(s.IndexOf(234));Console.WriteLine(s.LastIndexOf(234));Console.WriteLine(s.IndexOf(57));Console.ReadKey();}} } 第一次查找找到了234返回第一次出现234时2的索引第二次查找找到了234返回最后一次出现234时2的索引第三次查找没有找到57返回-1。最终结果 1 8 -1 StartsWith()/EndsWith() 作用判断字符串是否以所查找的字符串开头/结束是则返回True否则返回False。 使用字符串变量.StartsWith(子字符串)/字符串变量.EndsWith(子字符串) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 12345671234567;Console.WriteLine(s.StartsWith(1234)); //s以1234为起始返回TrueConsole.WriteLine(s.EndsWith(567)); //s以567结束返回TrueConsole.WriteLine(s.StartsWith(57)); //s不以57为起始返回FalseConsole.ReadKey();}} } 最终输出结果为 True True False Replace() 作用将指定字符串中子字符串s1更换为子字符串s2返回更新后的字符串。 使用更新字符串.Replace(s1,s2) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 12345671234567;Console.WriteLine(s.Replace(1234,000)); //将s中所有的1234子字符串更换为000Console.ReadKey();}} } 最终输出为 000567000567 此处可见实际上Replace将字符串中全部匹配的子字符串都进行了更换。 Contains() 作用判断字符串中是否存在某一子字符串是则返回True否则返回False。 使用字符串变量.Contains(子字符串) 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s 12345671234567;Console.WriteLine(s.Contains(1234)); //s中存在1234返回TrueConsole.WriteLine(s.Contains(000)); //s中不存在000返回FalseConsole.ReadKey();}} } 输出结果如下 True False Trim()/TrimEnd()/TrimStart() 作用去除字符串首尾/尾部/首部空格返回去除空格后的字符串。 使用字符串变量.Trim()/字符串变量.TrimEnd()/字符串变量.TrimStart() 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s string ;Console.WriteLine(\ s.Trim() \); //去除s首尾空字符Console.WriteLine(\ s.TrimEnd() \); //去除s尾部空字符Console.WriteLine(\ s.TrimStart() \); //去除s首部空字符Console.ReadKey();}} } 输出结果如下 string   string string   IsNullOrEmpty() 作用判断字符串是否为空字符串或者为null是则返回True否则返回False。 注意字符串为空字符串与为null不同。空字符串占有内存空间null则不占有。 使用string.IsNullOrEmpty(字符串变量)        此处使用方法与前面几个函数不同 使用实例如下 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace code {class Program{static void Main(string[] args){string s1 string ; //字符串非空string s2 null; //字符串为nullstring s3 ; //字符串为空字符串Console.WriteLine(string.IsNullOrEmpty(s1));Console.WriteLine(string.IsNullOrEmpty(s2));Console.WriteLine(string.IsNullOrEmpty(s3));Console.ReadKey();}} } 输出结果如下 False True True
http://www.zqtcl.cn/news/619862/

相关文章:

  • 秒收网站鞍山58同城
  • 模板网站建设方案wordpress系统在线升级
  • 男女做爰视频网站在线视频seo也成搜索引擎优化
  • 网站优化和网站推广深圳市高端网站建设
  • 宁波网站建设优化企业推荐四川省建设厅新网站
  • 哈尔滨模板自助建站优秀的电子商务网站
  • 有站点网络营销平台wordpress 退出 跳转
  • 网站建设的内容规划国内做网站群平台的公司
  • 浙江省院士专家工作站建设网站网站的请求服务做优先级
  • 建一个国外网站多少钱邵阳建设银行网站是多少
  • h5页面有哪些seo关键词智能排名
  • 电信的网做的网站移动网打不开该找电信还是移动杨和勒流网站建设
  • 网站建设添加背景命令做货代哪个网站上好找客户
  • 专做宝宝的用品网站武昌网站建设价格多少钱
  • 福田网站设计处理智慧团建app官网下载
  • 福州网站建设效果开发公司经营管理存在的问题
  • 如何自己做企业网站织梦做的网站织梦修改网页
  • 医院网站开发兼职怎么做可以支付的网站
  • 网站开发大概需要多久湛江招聘网最新招聘
  • 免费建网站 手机网站深圳网站设计(深圳信科)
  • 辽宁做网站的公司工作室网站建设的意义
  • 南京网站搜索排名免费企业网站空间
  • 手机要访问国外网站如何做附近学电脑在哪里报名
  • 免费建网站哪个网好中国建设银行信用卡黑名单网站
  • 网页设计好看的网站中小型网站建设 教案
  • 优秀网站设计案例行业内做网站的公司排名
  • 个人备案网站能做商城吗长沙app制作公司哪家好
  • 成都网站建设方案优化旺道seo怎么优化网站
  • 九江县建设规划局网站wordpress多个博客
  • 绵阳住房和城乡建设局网站做服装外贸的网站