[Solved] How to remove common letters in two Strings in iOS SDK? [duplicate]

You can proceed similar as in this answer to your previous question: NSString *string1 = @”optimusprime”; NSString *string2 = @”dejathoras”; // Combine strings: NSString *combined = [string1 stringByAppendingString:string2]; // Now remove duplicate characters: NSMutableString *result = [combined mutableCopy]; [result enumerateSubstringsInRange:NSMakeRange(0, [result length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { // Check if … Read more

[Solved] Setter in NSString iOS

You need to use Singleton class to expose variables or objects to the entire project or create global variables. Create sharedInstance of TokenClass class and create property which can be accessed anywhere in your .h file //token class header file @interface TokenClass : NSObject @property (nonatomic,strong) NSString *tokenValue; //create static method + (id)sharedInstance; in .m … Read more

[Solved] Get substring from string variable and save to NSMutableArray [closed]

NSString *str = @”M||100|??|L||150|??|S||50″; NSString *stringWithoutBars = [str stringByReplacingOccurrencesOfString:@”||” withString:@” “]; NSMutableArray *array = [[NSMutableArray alloc]initWithArray:[stringWithoutBars componentsSeparatedByString:@”|??|”]]; solved Get substring from string variable and save to NSMutableArray [closed]

[Solved] What is the best way to convert an array with NSStrings to NSDecimalNumber?

A very simple Category on NSArray will allow you to use map as seen in other languages @interface NSArray (Functional) -(NSArray *)map:(id (^) (id element))mapBlock; @end @implementation NSArray (Functional) -(NSArray *)map:(id (^)(id))mapBlock { NSMutableArray *array = [@[] mutableCopy]; for (id element in self) { [array addObject:mapBlock(element)]; } return [array copy]; } @end Now you can … Read more

[Solved] To convert a particular format to NSDate [closed]

Use this code to get the Current Date NSDateFormatter *dateFor=[[NSDateFormatter alloc]init]; NSString *currentDateString = @”2014-01-08T21:21:22.737+05:30″; [dateFor setDateFormat:@”yyyy-MM-dd’T’HH:mm:ss.SSSZZZZ”]; NSDate *currentDate = [dateFor dateFromString:currentDateString]; NSLog(@”CurrentDate:%@”, currentDate); 5 solved To convert a particular format to NSDate [closed]