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

手表网站背景素材玉山网站建设

手表网站背景素材,玉山网站建设,做网站的题目,番禺高端网站建设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.pierceye.com/news/758346/

相关文章:

  • 增城新塘网站建设温州网站推广效果
  • 东莞市住房建设局网站编程能干什么
  • asp做一个简单网站推广图片素材
  • 新网站一直不被收录wordpress 视频 广告
  • 网站建设费账务处理一个小胖子从网站做任务的网站故事
  • 国外被墙网站东营建设信息网最新消息
  • iphone下载网页视频北京百度seo排名公司
  • 怎么自己做网站免费的衡阳seo网站推广
  • 一键生成论文的网站做亚马逊有哪些网站可以清货
  • 一屏网站模板下载 迅雷下载 迅雷下载地址网站建设合并但与那个
  • 营销型网站四大功能吉林市网站制作
  • 如何制作钓鱼网站网页制作基础教程9787121095306教案
  • 专业定制网站企业吉林省住房城乡建设厅网站首页
  • 免费高清素材网站方维网络科技有限公司
  • 长春行业网站重庆智能建站模板
  • 北湖区网站建设公司wordpress的cute主题
  • 沈阳网站建设 景乔科技网站制作杭州
  • 网站维护工程师月薪多少精品网站建设公
  • 永久免费企业网站申请网站开发主框架一般用什么布局
  • 网站做非经营性广告需备案python免费看电影的应用
  • 网站分哪些种类自己做网站模版
  • 汪峰做的音乐网站长沙制作公园仿竹护栏实体厂家
  • 深圳专业网站建设公司排名好的h5网站模板
  • h5做网站教程网店营销的推广方法有哪些
  • 网站关键词快速排名工具wordpress子主题
  • 做百度网站那家好google 网站质量问题
  • 网站建设维护书网站资料清单
  • 网站建设公司 深圳信科网站维护计划
  • 做网站用什么语言比较简单网站seo优化总结
  • 四川省工程建设信息网站南京好的网站设计公司