字符串的连接与分割.pptx

字符串的连接与分割 教学目标知识目标熟悉字符串的连接方法熟悉字符串的分割方法能力目标能够合理运用String类的连接与分割方法 String字符串的连接public String concat(String str)用于将参数中的字符串str连接到当前字符串的后面,效果等价于+。【例子】String str = aa.concat(bb).concat(cc); //相当于String str = aa+bb+cc; String 字符串的分割String[] split(String str)用于将str作为分隔符进行字符串分解,分解后的字符串在字符串数组中返回。【例子】 String str1 = asd!qwe,zxc#; String[] strs = str1.split(!|#|,); //str1[0] = asd; //str1[1] = qwe; //str1[2] = zxc; 知识点小结1、concat方法的作用。2、split方法的作用。 谢 谢!

文档评论(0)

1亿VIP精品文档

相关文档