我正嘗試使用Java中的replaceall函數刪除所有破折號( - )和逗號(,)。但是,我只能刪除短劃線或逗號。我怎樣才能解決這個問題?用空格代替Java中的破折號和逗號
if (numOfViewsM.find()){
if (numOfViewsM.toString().contains(","))
{
numOfViews =Integer.parseInt(numOfViewsM.group(1).toString().replaceAll(",", ""));
}
else if (numOfViewsM.toString().contains("-"))
{
numOfViews = Integer.parseInt(numOfViewsM.group(1).toString().replaceAll("-", ""));
}
else
numOfViews = Integer.parseInt(numOfViewsM.group(1));
}