Change the first character in each word of a string to uppercase

前端 未结 2 922
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 18:25

I found the function below :

CFStringCapitalize

\"Changes the first character in each word of a string to uppercase (if it is a low

2条回答
  •  北海茫月
    2020-12-01 18:51

    The capitalizedString method exists in NSString class, see the docs

    NSString *foo = @"this is all lower";
    NSString *fooUpper = [foo capitalizedString];
    

    Note that this isn't iPhone specific, same code on the Mac.

提交回复
热议问题