iphone - Objective-C (iOS) replace all occurrences of Wildcard in a string with the alphabet -



iphone - Objective-C (iOS) replace all occurrences of Wildcard in a string with the alphabet -

first of all, not homework! :)

say have nsstring: "the?or?" each wildcard want string come @ to the lowest degree 26 (not including 'ñ' , 'ng' seem have been added countries phillipines). word 2 ? give me 26^2 (i think) results.

i want homecoming nsarray of following:

theaora theaorb theaorc ... thezora thezorb thezorc ... thezorx thezory thezorz

since recursion (i assuming) having issues...

i working on this:

nsarray *countofwildcardarray = [wordtosearch componentsseparatedbystring:@"?"]; int countofwildcard = [countofwildcardarray count] - 1; if (countofwildcard > 0) { ( nsinteger = 0; < countofwildcard; i++) { nslog(@"looking wildcard #%i",i); for(char = 'a'; <= 'z'; a++) { nsstring *tempstringa = [nsstring stringwithstring:wordtosearchfor]; ...... } } }

and lost. don't think on right track. said, recursion bothers me lot :)

does have thought of do?

so, after having received few questions state issue has letting user know how many anagrams can create resulting words. have fast way of making anagrams word list , looking create word list anagrams made from. sure there improve way above method. asking help finding best way of creating array.

try this,

nsarray *wildcardarray; nsarray *countofwildcardarray = [wordtosearch componentsseparatedbystring:@"?"]; int countofwildcard = [countofwildcardarray count] - 1; if (countofwildcard > 0) { for(char = 'a'; <= 'z'; a++) { for(char b = 'a'; b <= 'z'; b++) { nsstring *tempstringa=[nsstring stringwithformat:@"%@%c%@%c",[countofwildcardarray objectatindex:0],a,[countofwildcardarray objectatindex:1],b]; [wildcardarray addobject:tempstringa]; } } }

iphone objective-c regex replace wildcard

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -