Nsstring

viewController.h



#import <UIKit/UIKit.h>
@interface ViewController : UIViewController

@end

viewController.m


#import "ViewController.h"

@interface ViewController ()
@property (nonatomic, strong) NSString *str1;
@property (nonatomic,strong) NSString *str2;
@property ( nonatomic,strong) NSString *str3;
@end

@implementation ViewController
@synthesize str1 = _str1;
@synthesize str2 = _str2;
@synthesize str3 = _str3;
- (void)viewDidLoad {
    [super viewDidLoad];
   self.str1 = @"string one";
    self.str2 = @"string two";
    self.str3=@"";
    //string one string two
    self.str3 = [self.str1 stringByAppendingString:self.str2];
    //(string one) -> **string two**
    self.str3 = [self.str3 stringByAppendingFormat:@"(%@)  -> **%@**",self.str1,self.str2];
    NSLog(@"%@",self.str3);
  
}

@end
Previous
Next Post »