"Buy Any Medium Cheese Crust Pizza Get 50% OFF on second pizza of same or lesser value.\r\n\r\nCode OPEN50\r\n\r\nT&C -\r\nOffer is not valid on Margherita, Cheesy Murgh, Cheesy Spicy Chicken.\r\nOffer can be withdrawn without any prior notice. \r\nOffer cannot be clubbed with any other offer.\r\n\r\n"
我已经完成了一些编码,但它出错了
void main() {
String input = "Get a FREE Garlic Bread Sticks on order.\r\n\r\nCode JAIPUR\r\n\r\nT&C -\r\nOffer is valid for Jaipur Outlets only.\r\nOffer can be withdrawn without any prior notice. \r\nOffer cannot be clubbed with any other offer.";
List<String> split1 = input.split("\r\n\r\n");
List<String> split2 = input.split("Code ");
List<String> split3 = input.split("\r\n");
print("split1 $split1");
print("split2 $split2");
print("split3x` $split3");
// Output: ['abc', 'def456']
var splited = [];
splited = [{
"desc":split1[0],
"code":split2[1],
"t&C":split3[2]
}];
print("\n----------------------------------------------\n");
print("splited:: $splited");
}
我要这样分手
[
{
"desc":"Buy Any Medium Cheese Crust Pizza Get 50% OFF on second pizza of same or lesser value.",
"code":"OPEN50",
"t&c":[
"Offer is not valid on Margherita, Cheesy Murgh, Cheesy Spicy Chicken.",
"Offer can be withdrawn without any prior notice.",
"Offer cannot be clubbed with any other offer."
]
}
]