replace(char oldChar, char newChar)回傳一個新的字串,它是通過用 newChar 替換此字串中出現的所有 oldChar 而生成的
import java.util.*; public class Main{ public static void main(String[] args) { String s1="我愛大海!大海好美!"; String s2="中國"; String s3=s1.replace("大海", s2); System.out.println(s3); } }

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/106070.html
標籤:其他
上一篇:字串簡單操作
下一篇:util之Map
