Home Tutorial Iphone Examples NSString lowercasestring

 
 

Share on Google+Share on Google+
NSString lowercasestring
Posted on: September 4, 2009 at 12:00 AM
Advertisement
This is the another example of change case, defined into NSString. Basically NSString provides three type of methods to change the case

iPhone NSString lowercasestring()

This is the another example of change case, defined into NSString. Basically NSString provides three type of methods to change the case ...

1.) lowercaseString: will change the string into lower case
2.) uppercaseString: String will be changed into upper case
3.) capitalizedString:use it, in case of changing first character of string in Caps

all of these can be used to serve the different purpose...but the way of defining them is almost similar. You can see how to define capitalizedString and uppercaseString into our previous examples. In this example we are going to show you how to change the string into lowercase using "lowercaseString", which is defined in NSString class.

The application will give following output:



Note: This example is similar to uppercaseString example. The only difference is that we have used lowercaseString instead of uppercaseString.

Find the code here:

lowercaseStringAppDelegate.h

#import <UIKit/UIKit.h>

@interface lowercaseStringAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;

    IBOutlet UIButton *button;

    NSString *string;

}

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

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

@property (nonatomic, retain) NSString *string;

-(IBAction) lowercaseString:(id)sender;

@end

lowercaseStringAppDelegate.m

#import "lowercaseStringAppDelegate.h"

@implementation lowercaseStringAppDelegate

@synthesize window;

@synthesize button;

@synthesize string;

-(IBAction) lowercaseString:(id)sender

{

    NSString *string1 = @"ROSE INDIA";

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

    NSString* changeString = [upperString lowercaseString];

    NSLog(changeString);

}

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

    // Override point for customization after application launch

    [window makeKeyAndVisible];

}

- (void)dealloc {

    [window release];

    [button release];

    [super dealloc];

}

@end

 

Click to Download Code

Advertisement

Related Tags for NSString lowercasestring:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 4, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com