私はこのスクリプトを持っています。原因私はウェブサイトから私の議題をスクラップしたいのですが、基本から始める必要があります。したがって、文字列を見つける方法を知る必要があります。私はすでにそのようなものを持っています。私も何も悪いことはしません。しかし、議事は30/31日あるので、私は1日をスクラップしたくありません。
以下に私のスクリプトが表示され、結果は次のようになります:Jamal Entingh
すべての名前を配列に入れるのが好きです。
私の議題には、L2040日のシフトや12:00〜18:45の時間、その他の場所などの変数が配列に含まれます。
これをまっすぐにするために、forループまたはwhileループについて考えていました。
したがって、naamとendの間のすべてを配列に設定する必要があります。
NSString *Field = @"naamJamal EntinghendnaamUlrich EsajasendnaamSerginho Herbertend";
NSString *Names = [[[[Field componentsSeparatedByString:@"naam"]objectAtIndex:1] componentsSeparatedByString:@"end"]objectAtIndex:0];
txtveld.text = Names;
ウェブサイトからのアレイのスクラップについてこの質問があります。
私は完全なhtmlを置くつもりはありませんが例
<ul class="rsevent">
<li class="rsevent"><a href="url 1"><strong>Partys going on</strong></a> <small>(5 augustus 2012)</small><small><p>The party is going on people be there.</p>
</small></li>
<li class="rsevent"><a href="url 2"><strong>Borgoe Party: vrijdag 31 augustus 2012</strong></a> <small>(31 augustus 2012)</small><small><p>Off Corso in Rotterdam is going down borgoe party</p>
</small></li>
<li class="rsevent"><a href="url 3"><strong>Dutch Kizomba Festival</strong></a> <small>(7 september 2012)</small><small><p>Dutch Kizomba Festival. The place where you need to be</p>
</small></li>
</ul>
これは私がイベントのためにウェブサイトから削った部分です。
NSString *AanvraagUrl = [NSString stringWithFormat:@"http://www.thewebsite.org/category/events/"];
NSString *CodeerUrl = [AanvraagUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *Url = [NSURL URLWithString:CodeerUrl];
NSString *Scrapper = [NSString stringWithContentsOfURL:Url encoding:NSASCIIStringEncoding error:nil];
NSString *Scrapdeel = [[[[Scrapper componentsSeparatedByString:@"<div class=\"agenda\">"]objectAtIndex:1]componentsSeparatedByString:@"div>"]objectAtIndex:0];
NSString *Events = [[[[Scrapdeel componentsSeparatedByString:@"<ul class=\"rsevent\">"]objectAtIndex:1]componentsSeparatedByString:@"</ul>"]objectAtIndex:0];
これは私が持っているワットです。すべてのデータを配列に入れたいのですが、私の質問はどうですか。ここにこのようなものがあります
NSArray *EventDate
NSArray *EventSubject
NSArray *EventInfo
CompenentsSeperatedByStringを使用して別の種類のループをもう一度試しましたが、1つの結果が繰り返されます。何人かの仲間が私を助けてくれます。