鉴于群友都是鸽子 这个逼企划我也没啥希望
写着玩的
public String yuukaTellYouSaveMoney (String smsString) {
//需要的话修改到配置文件
final String startWord = "支出";
final String currency = "元";
try {
//正则表达式获取金额
Pattern pattern = Pattern.compile("\\d+\\.\\d+");
Matcher matcher = pattern.matcher(smsString.substring(smsString.indexOf(startWord),smsString.indexOf(currency)));
if(matcher.find()){
String amountString = matcher.group();
double amount = Double.parseDouble(amountString);
//修改到配置文件输出
if (amount>100){return "sensei你又在乱花钱哦";}
if (amount>200){return "sensei你又在乱花钱哦";}
if (amount>300){return "sensei你又在乱花钱哦";}
if (amount>400){return "sensei你又在乱花钱哦";}
if (amount>600){return "sensei你又在乱花钱哦";}
}else {
throw new RuntimeException("错误字符: "+smsString);
}
}catch (Throwable e){
throw e;
}
return null;
}
标签:return,String,管账,smsString,bot,碎片,amount,乱花钱,sensei
From: https://www.cnblogs.com/eveningSheep/p/17605551.html