Saturday, May 18, 2013

NSString lowercaseString example ios


[NSString lowercaseString]

Returns lowercased representation of the receiver.
- (NSString *)lowercaseString
Return Value
A string with each character from the receiver changed to its corresponding lowercase value.
Discussion of [NSString lowercaseString]
Case transformations aren’t guaranteed to be symmetrical or to produce strings of the same lengths as the originals. The result of this statement:
lcString = [myString lowercaseString];
might not be equal to this statement:
lcString = [[myString uppercaseString] lowercaseString];
For example, the uppercase form of “ß” in German is “SS”, so converting “Straße” to uppercase, then lowercase, produces this sequence of strings:
  • “Straße”
  • “STRASSE”
  • “strasse”


Example of [NSString lowercaseString]

NSString *noCaps = [yourString lowercaseString];

Example of [NSString lowercaseString]
 NSString *input = @"ÁlgeBra";

  NSString *correctCase = [NSString stringWithFormat:@"%@%@",
                           [[input substringToIndex:1] uppercaseString],
                           [[input substringFromIndex:1] lowercaseString]];

  NSString *result = [[[NSString alloc] initWithData:[correctCase dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES] encoding:NSASCIIStringEncoding] autorelease];

  NSLog( @"%@", result );
Example of [NSString lowercaseString]
NSString *original = @"blah"
 NSString *lowercase = [original lowercaseString];