NSString lowercasestring


 

NSString lowercasestring

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

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 {

0

    [window release];

    [button release];

    [super dealloc];

1

}

@end

 

2

Click to Download Code

Ads