How to use output from a splited sms [closed]

喜欢而已 提交于 2019-12-02 09:31:20

You will need to define the rules for how to translate the input into an action on the database. To get you started, you can write if statements like this for each rule:

if (a.length == 3 && a[0] == "pay" && a[1] == "merchant")
{
    double amount = Double.parseDouble(a[2]);
    // connect to database and add amount to the merchant
    // UPDATE [AmountTable] SET [Amount] = [Amount] + ?
    // WHERE [Type] = 'Merchant' (or whatever the logic is)
}
String [] message_parts = message.split("#");
// check format
String pay = message_parts[0];
String merchant = message_parts[1];
String amount_string = message_parts[2];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!