I have a string that contains <name>James Jones</endofname>
how would i get the name from the centre pragmatically.
Thanks
James
I have a string that contains <name>James Jones</endofname>
how would i get the name from the centre pragmatically.
Thanks
James
You insist this is not XML parsing but your example looks an awful lot like it. So what is it?
Going on the assumption that this really is an XML document (because your example screams "yes it is!"), NSXMLParser is by far your best bet.
For some reason you've specified that you don't want xml parsing. I don't know why this is a requirement, but I'd suggest using a regex then:
^[^>]*>([^<]*)
is a somewhat crude one but it'll get you started.
For this particular example, you can write [string substringWithRange:NSMakeRange(6, 11)]
. For more complicated examples, you'd need to know the full extent of the language you're parsing and create a parser for it.