public class lianxi {
public static void main(String[] args) {
//将字符串转化字符数组
/*String str = "abcde";
char[] ch = str.toCharArray();
System.out.print("[");
for (int x = 0; x < ch.length; x++) {
if (x < ch.length - 1)
System.out.print(ch[x] + ",");
else
System.out.print(ch[x]+"]");*/
System.out.println("..................");
//将字符串中的字符替换
String s=" abcde ";
String s2=s.replace("cd", "fe");
System.out.println(s2);
String s3=s.trim();
System.out.println(s3);
}
}
|
|