nsarray - Changing line of word numbers into numbers objective c -
nsarray - Changing line of word numbers into numbers objective c -
hi objective c beginner , played around code got developer seek alter line of word numbers (two hundred , 30 two) numbers (232). have managed single word alter number cant figure out how link words gaps. 20 turned 20 20 2 doesnt homecoming anything. tips please on do?
//text recognition nsarray *values = [[nsarray alloc]initwithobjects: @"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",nil]; nsarray *keys = [[nsarray alloc]initwithobjects: @"zero",@"one",@"two",@"three",@"four",@"five",@"six",@"seven",@"eight",@"nine" , nil]; numbers = [[nsdictionary alloc]initwithobjects:values forkeys:keys]; //passed text (nsextensionitem *item in self.extensioncontext.inputitems) { (nsitemprovider *itemprovider in item.attachments) { //nslog(@"%@",itemprovider); if ([itemprovider hasitemconformingtotypeidentifier:(nsstring *)kuttypepropertylist]) { //safari __weak actionviewcontroller *sself = self; [itemprovider loaditemfortypeidentifier: (nsstring *) kuttypepropertylist options: 0 completionhandler: ^(id<nssecurecoding> item, nserror *error) { if (item != nil) { nsdictionary *resultdict = (nsdictionary *) item; sself.jsstring = resultdict[nsextensionjavascriptpreprocessingresultskey][@"selection"]; //update ui //.........i have cutting code out -(void)selection{ //text recognition if ([self.jsstring isequaltostring:@""]) { [_calculations settext:@"0"]; } else { (nsstring *key in numbers) { [_calculations settext:self.jsstring]; if( [self.jsstring caseinsensitivecompare:key] == nsorderedsame) { [_calculations settext:[numbers objectforkey:key]]; break; } } }
objective-c nsarray
Comments
Post a Comment