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
您可能关注的文档
- VerilogHDL硬件描述-3.ppt
- VF1-4章习题答案.doc
- verilog的语法之一.ppt
- 宏就是用公式来加工零件的.doc
- 宏的基本操作教案.doc
- 宏程序及子程序.doc
- 宏程序在数控编程中的应用.doc
- 宏的应用教学设计方案.doc
- 宏观经济管理作业题.doc
- 宝洁英文填写.doc
- 腾讯安全沙龙:红队视角下的海外SRC猎场:战略、战术与突破.pdf
- 【icap】ETS的范围扩展:设计和政策挑战.docx
- bcg -美国最高法院关于关税的裁决对你的企业意味着什么 What Does the US Supreme Court Ruling on Tariffs Mean for Your Business.pdf
- 2026届甘肃兰州市高三下学期第一次模拟考试历史试卷(扫描版,含答案).docx
- bcg -零售银行如何让人工智能代理发挥作用 How Retail Banks Can Put AI Agents to Work.pdf
- 住宅项目规范解读(GB 55038-2025) -培训 - 房地产-2025.docx
- 盘扣式脚手架工程量自动计算表 -培训 -房地产-2025.pdf
- 广东省汕头市2024-2025学年高三下学期第一次模拟考试英语学试题(含答案).docx
- 品牌研究+_+2025+CAPSE中国航司品牌榜单.pdf
- 【银河专题】如何看待豆粕内外价差关系.pdf
原创力文档

文档评论(0)