蘇詩涵Java方法length().charAt().EXCEL函數LEN,MID
public class Main { /*蘇詩涵2022.12.26德明科大財金一甲*/
public static void main(String[] args) {
String a = "狗吃屎,貓抓鼠,老猴愛作怪", b = "";
System.out.println("原來: " + a);
int c = a.length(); /*方法length()*/
System.out.println("長度: "+ c);
for (int i = 0; i < c; i++) /*迴圈*/
b = a.charAt(i) + b;/*一個個字元接到前面,變成反向*/
System.out.println("反向: "+ b);
}
}
留言
張貼留言