mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Add method to cap JUST the first letter
This commit is contained in:
parent
ce36666d79
commit
3a0f7d8882
2 changed files with 14 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
@interface NSString (Methods)
|
||||
|
||||
- (NSString *) capitalizedFirstCharacterString;
|
||||
- (NSString *) splitCamelCaseString;
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,6 +7,19 @@
|
|||
|
||||
@implementation NSString (Methods)
|
||||
|
||||
// Return a string with the first character capitalized
|
||||
- (NSString *) capitalizedFirstCharacterString
|
||||
{
|
||||
if ([self length] == 0)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat: @"%@%@",
|
||||
[[self substringToIndex: 1] uppercaseString],
|
||||
[self substringFromIndex: 1]];
|
||||
}
|
||||
|
||||
// Split a camel case string into a string with spaces
|
||||
// e.g. "camelCaseString" becomes "camel Case String"
|
||||
- (NSString *) splitCamelCaseString
|
||||
|
|
Loading…
Reference in a new issue