Hi, everyone,
I want to ask something about the NSString in objective C. I use the following code to retrieve some of the HTML content.
NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *data = [[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
In the data
, it contains lot of HTML code e.g.
<!DOCTY... >
...
// retrieve the content from <form> to </form>
<form method="post" action="...">
<input type="..." name="name_1" value="value_1" />
<input type="..." name="name_2" value="value_2" />
</form>
...
</html>
I want to get the content of the name_1, value_1, name_2 and value_2 to and NSString, just like
NSString A = "name_1"
NSString B = "value_1"
NSString C = "name_2"
NSString D = "value_2"
Does the NSString provide this kind of search or method to retrieve the string? Thank you very much.