In the project development process, often need to parse the string to get the tag value, so as to match the stored value in the local database, to achieve the effect of data transmission;
Including the game is also the case, through the string for the operation, or the parsing of strings, so as to achieve the purpose of parsing;
I'll build you a wheel---phase two.
String emulation parsing:
<span style= "font-family:arial, Helvetica, Sans-serif;" >nsarray *array = [[Nsarray alloc]initwithobjects:@ "Tease a", @ "Tease B", @ "Tease C", @ "Tease D", @ "Tease E", @ "Tease F", nil];</span>
nsmutablestring * mutablestring = [[Nsmutablestring alloc] init]; nsstring* string = [[NSString alloc] initwithformat:@ "%@", doctor.docspecial]; for (int i=1; i<string.length; i++) { nsstring *tmpstring = [string Substringwithrange:nsmakerange (i,1)]; if ([tmpstring isequal: @ "1"]) { [mutablestring appendformat:@ '%@, ', [array objectatindex:i]; } } NSLog (@ "%@", mutablestring);
Well, isn't it convenient.
Good attention: Http://blog.csdn.net/happylaoxu Http://blog.csdn.net/happylaoxu
Next issue, I'll build you a wheel: gently look forward to----!
I'll build you a wheel.-Phase II-iOS string parsing simulates the transfer of JSON data.