![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 Eric Chen ![]()
![]() |
1樓 |
請參考!
import java.io.*; public class RegularJude { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.print("Please Input a String :"); String str = br.readLine(); if (!str.matches("[0-9a-zA-Z_]+")) { System.out.println("Your Input is not legal !"); } else System.out.println("God Job !!"); } } }
本篇文章回覆於2020-04-10 14:08
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
2樓
最有價值解答
海洋風 ![]() |
不要數字的話,0-9 拿掉!
!str.matches("[a-zA-Z_]+")
本篇文章回覆於2020-04-10 14:20
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔-- |
回覆 |
如要回應,請先登入. |