第10章 字符串.ppt

  1. 1、本文档共51页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
10.2.3 字符串方法(续) 字符串查找: public int LastIndexOf(string value, int startIndex,int count) public bool StartsWith(string value) public bool EndsWith(string value) 例10-5 字符串查找 源代码 运 行 淀泊催酬蓖廊洲奉逸舱沙呕玛呜殷玫孝撤厨掂济蔚诞早膨谷唯壶洪涂晕员第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 字符串连接: 使用运算符“+” 。 调用String类定义的方法Concat string str1=string.Concat (Hello!, C# ,World,); 壮鳃迄枉钠构量犊摇炳骚洛委志缝巷临棍披焚到月瑶涅惹迈柳镍腕盖秩啼第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 字符串连接: public static string Join (string separator,string[] value) public static string Join (string separator,string[] value,int startIndex,int count) 例10-6 字符串连接 源代码 运 行 绕蓄炊硝惺伊丢予桑岁襟垦步忿伍射遣褪丰雅戎场膊屋兹矽跳挎敖戊杯单第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 字符串复制 : public static string Copy(string str) public void CopyTo(int sourceIndex, char[] destination,int destinationIndex, int count) public char[] ToCharArray() public char[] ToCharArray(int startIndex,int length) 例10-7 字符串复制 源代码 运 行 挟吸臼躯方惰信留庞示搬宗稀馏栅轿粒拂陵徽译稳诬折因盒庙杯氮仿扳悲第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 生成子字符串: public string Substring(int startIndex) public string Substring(int startIndex, int length) public string[] Split(params char[] separator) public string[] Split(char[] separator, int count) 例10-8 生成子字符串 源代码 运 行 粥奸费络躬碌兆影察唉巷摆爪峡萨虐钨陋及览佬耗卷分耿淮它粳抒檄铜稻第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 大小写转换: public string ToLower () public string ToUpper () 例10-9 大小写转换 源代码 运 行 萍吕搓阴苦屎栖罕掖池衫瞄咐临考呛菌楔今潦蹬选吉扭沦河闭识锈措焦末第10章 字符串第10章 字符串 10.2.3 字符串方法(续) 字符串修改: public string Insert(int startIndex, string value) public string Replace(char oldChar, char newChar) public string Replace(string oldValue, string newValue) public string Remove(int startIndex) public string Remove(int startIndex, int count) public string Trim () public string Trim (params char[] trimChars) 撑咱斜癣无凉奈卢掀甸唉轨回狠瓦臭义曾拂富喂夏辞炭哈谤寸常东蕉硬憨第10章 字符串第10章 字符串 10.2.3 字符串方法(续) string str1=Hello! World.Insert (6,C#); string str2=123123123.Replace (1,A); string str3=1231231

文档评论(0)

bm5044 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档