从xcode

时间:2016-10-26 12:18:19

标签: ios objective-c xcode

/ ********************************************** ****** / HTML

<html>
<head></head>
<body>
<center><br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail<br><br>
<table cellspacing="4" cellpadding="4">
<tbody>
<tr><td>order_id</td><td>OC000272</td>
</tr><tr><td>tracking_id</td><td>105128300276</td></tr>
<tr><td>bank_ref_no</td><td>null</td></tr>
<tr><td>order_status</td><td>Aborted</td></tr>
<tr><td>failure_message</td><td></td></tr>
<tr><td>payment_mode</td><td>null</td></tr>
<tr><td>card_name</td><td>null</td></tr>
<tr><td>status_code</td><td></td></tr>
<tr><td>status_message</td><td>null</td></tr>
<tr><td>currency</td><td>INR</td></tr>
<tr><td>amount</td><td>1.0</td></tr>
<tr><td>billing_name</td><td>SM Test</td></tr>
<tr><td>billing_address</td><td>Katargam</td></tr>
<tr><td>billing_city</td><td>Surat</td></tr>
<tr><td>billing_state</td><td>Gujarat</td></tr>
<tr><td>billing_zip</td><td>395004</td></tr>
<tr><td>billing_country</td><td>India</td></tr>
<tr><td>billing_tel</td><td>8156034071</td></tr>
<tr><td>billing_email</td><td>smdeveloper14@gmail.com</td></tr>
<tr><td>delivery_name</td><td>Nilpari</td></tr>
<tr><td>delivery_address</td><td>Katargam</td></tr>
<tr><td>delivery_city</td><td>Surat</td></tr>
<tr><td>delivery_state</td><td>Gujarat</td></tr>
<tr><td>delivery_zip</td><td>395005</td></tr>
<tr><td>delivery_country</td><td>India</td></tr>
<tr><td>delivery_tel</td><td>8140338557</td></tr>
<tr><td>merchant_param1</td><td></td></tr>
<tr><td>merchant_param2</td><td></td></tr>
<tr><td>merchant_param3</td><td></td></tr>
<tr><td>merchant_param4</td><td></td></tr>
<tr><td>merchant_param5</td><td></td></tr>
<tr><td>vault</td><td>N</td></tr>
<tr><td>offer_type</td><td>null</td></tr>
<tr><td>offer_code</td><td>null</td></tr>
<tr><td>discount_value</td><td>0.0</td></tr>
<tr><td>mer_amount</td><td>1.0</td></tr>
<tr><td>eci_value</td><td></td></tr>
<tr><td>retry</td><td>null</td></tr>
<tr><td>response_code</td><td></td></tr>
<tr><td>billing_notes</td><td></td></tr>
</tbody>
</table><br>
</center>
</body>
</html>

/ ********************************************** ****** /鉴于结果

感谢您与我们一起购物。我们会通过电子邮件向您发送有关订单状态的信息order_id OC000272 tracking_id 105128300276 bank_ref_no null order_status aborted failure_message payment_mode null card_name null status_code status_message null currency INR amount 1.0 billing_name SM Test billing_address Katargam billing_city苏拉特billing_state古吉拉特billing_zip 395004 billing_country印度billing_tel 8156034071 billing_email smdeveloper14@gmail.com delivery_name Nilpari delivery_address Katargam delivery_city苏拉特delivery_state古吉拉特delivery_zip 395005 delivery_country印度delivery_tel 8140338557 merchant_param1 merchant_param2 merchant_param3 merchant_param4 merchant_param5拱顶ñOFFER_TYPE空offer_code空discount_value 0.0 mer_amount 1.0 eci_value重试空RESPONSE_CODE billing_notes

/ ********************************************** ****** /想要结果

order_id OC000272 tracking_id 105128300276 bank_ref_no null order_status已中止 failure_message payment_mode null card_name null STATUS_CODE status_message null 货币INR 金额1.0 billing_name SM测试 billing_address Katargam billing_city苏拉特 billing_state古吉拉特邦 billing_zip 395004 billing_country印度 billing_tel 8156034071 billing_email smdeveloper14@gmail.com delivery_name Nilpari delivery_address Katargam delivery_city苏拉特 delivery_state古吉拉特邦 delivery_zip 395005 delivery_country印度 delivery_tel 8140338557 merchant_param1 merchant_param2 merchant_param3 merchant_param4 merchant_param5 保险库N. offer_type null offer_code null discount_value 0.0 mer_amount 1.0 eci_value 重试null RESPONSE_CODE billing_notes

/ ********************************************** ****** /

1 个答案:

答案 0 :(得分:1)

你应该使用类似的东西:

NSString *body = <# Your html body #>;
NSString *substring = [body substringFromIndex:[body rangeOfString:@"<tbody>"].location];
NSLog(@"%@", substring);

您可能也希望停留在</tbody>,然后使用substringToIndex: