我試圖去掌握正則表達式的語法。有誰知道我可以做以下工作嗎?在一個正則表達式小數位上的Java匹配
// if there is already a decimal place in the string ignore
String origString = txtDisplay.getText();
Pattern pattern = Pattern.compile("/\\./");
//pattern =
if(pattern.matcher(origString)){
System.out.println("DEBUG - HAS A DECIMAL IGNORE");
}
else{
System.out.println("DEBUG - No Decimal");
}
感謝您的意見。我會繼續嘗試。我是新來的Java所以即時通訊嘗試學習如何做到這一點。 –