java字符串常用方法总结(更新中..)

一.String类

1.字符串拼接

1         // 字符串拼接
2         String str1 = "abcd";
3         String str2 = "efgh";
4         System.out.println(str1 + str2);        // 用 +
5 
6         System.out.println(str1.concat(str2));  // 用 concat() 方法    

猜你喜欢

转载自www.cnblogs.com/hejjon/p/11013665.html