Open Re2906 opened 2 weeks ago
String input = "Amount: \"201057993\"\n" + "QueryId: 702837699428045\n" + "Step:\n" + " Params:\n" + " KindOut: false\n" + " Limit: \"401857633816219\"\n" + " Next: null\n" + " PoolAddr: 0:231324b5b22cfb8307237fde6c8333520ee5a96b3f365e08264c2b2a86271ac1\n" + "SwapParams:\n" + " Deadline: 1724087188\n" + " FulfillPayload: null\n" + " RecipientAddr: 0:4818f679ede118884806590b9b705a00fa6aa0cf7009d4b3d128ff263b031c88\n" + " ReferralAddr: 0:d9949a2b4a80787112796fc82dd2a4786e42dfcd50d55dee5298c3dc125d1304\n" + " RejectPayload: null";
String[] lines = input.split("\n"); String amount = ""; String queryId = ""; for (String line : lines) { if (line.startsWith("Amount:")) { amount = line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\"")); } else if (line.startsWith("QueryId:")) { queryId = line.substring(line.indexOf(":") + 2); } } assertEquals("201057993", amount); assertEquals("702837699428045", queryId); }
}
Thfdfbv
String input = "Amount: \"201057993\"\n" + "QueryId: 702837699428045\n" + "Step:\n" + " Params:\n" + " KindOut: false\n" + " Limit: \"401857633816219\"\n" + " Next: null\n" + " PoolAddr: 0:231324b5b22cfb8307237fde6c8333520ee5a96b3f365e08264c2b2a86271ac1\n" + "SwapParams:\n" + " Deadline: 1724087188\n" + " FulfillPayload: null\n" + " RecipientAddr: 0:4818f679ede118884806590b9b705a00fa6aa0cf7009d4b3d128ff263b031c88\n" + " ReferralAddr: 0:d9949a2b4a80787112796fc82dd2a4786e42dfcd50d55dee5298c3dc125d1304\n" + " RejectPayload: null";
}