Given the string and a number, this function will produce all possible combinations of all the letters from that string.
That is, if I pass "ABCD" and 3 then I should get the following output:
ABC ABD ACD BCD
This code is
- (zero) viewDidoadload {[Super Viewedload]; [Self expansion_compression: @ "ABCD" arg2: @ "" arg3: 3]; } - (zero) extension_compos: (NSString *) remaining_string arg2: (NSString *) s arg3: (int) remains_depth {if (remains_depth == 0) {printf ("% s \ n", [UTF8String]); Return; } For (int k = 0; k & lt; [left_frumber length]; + + k) {s = [s stringbapping string: [[remaining_string substringsfindexx: k] substringToIndex: 1]]; [Self-expansion_comments: [remaining_strawing substringfoundandx: k + 1] arg2: s arg3: living_disk-1]; } Return; }
Instead it is the one who prints it
abc abcd abcd abcd
Only one quick and dirty solution (variable name names do not change and similar) for their function
- (zero) class = "post-text" itemprop = "text" >
Expand_combinations: (NSString *) left_string arg2: (NSString *) s arg3: (int) remains_depth {NSString * newString = [balance_string string byerplaceing accountCarrayAmerica: NSMKernage (stay_disk, 1) withString: @ ""]; // NSLog (newString); If (stay_path == 0) {printf ("% s \ n", [UTF 8 string]); Return; } [Self-detail_composition: left_string arg2: s arg3: stay_district-1]; Return; }
Output (I used NSLog)
2010-09-26 04: 27: 26.462 untitled [5417: 207] ABC 2010 -09-26 04: 27: 26.462 untitled [5417: 207] ABD 2010-09-26 04: 27: 26.463 Untitled [5417: 207] ACD 2010-09-26 04: 27: 26.467 Without Title [5417: 207] BCD
Comments
Post a Comment