NSString uppercaseString


 

NSString uppercaseString

In the previous example we have seen that how to change first character of string into upper case. But in this "NSString uppercaseString" example, we are going to show you how to convert all the string into upper case. 

In the previous example we have seen that how to change first character of string into upper case. But in this "NSString uppercaseString" example, we are going to show you how to convert all the string into upper case. 

iPhone NSString uppercaseString()

In the previous example we have seen that how to change first character of string into upper case. But in this "NSString uppercaseString" example, we are going to show you how to convert all the string into upper case. 

The main purpose of using "uppercaseString" of NSString is to converting lowercase to upper case string.

Syntax for NSString uppercaseString:

NSString *upperString = [[NSString alloc] initWithFormat:string1];

NSString* changeString = [upperString uppercaseString];

The application is window based, you see the code given below...

uppercaseStringAppDelegate.h

#import <UIKit/UIKit.h>

 @interface uppercaseStringAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

    IBOutlet UIButton *button;

}

 @property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet UIButton *button;

 -(IBAction) uppercaseString:(id)sender;

 @end

uppercaseStringAppDelegate.m

#import "uppercaseStringAppDelegate.h"

 @implementation uppercaseStringAppDelegate

@synthesize window;

@synthesize button;

-(IBAction) uppercaseString:(id)sender

{

    NSString *string1 = @"roseindia";

    NSString *upperString = [[NSString alloc] initWithFormat:string1];

    NSString* changeString = [upperString uppercaseString];

    NSLog(changeString);

}

- (void)applicationDidFinishLaunching:(UIApplication *)application {   

    // Override point for customization after application launch

    [window makeKeyAndVisible];

}

0

- (void)dealloc {

    [window release];

    [button release];

1

    [super dealloc];

}

@end

2

The NSString uppercaseString application will give the following output:

Click to Download Code

3

Ads