Converting all text to lower case in Objective-C

前端 未结 3 1027
梦如初夏
梦如初夏 2020-12-13 11:58

I have a textfield in my iOS app where the user is supposed to input some text. But I was wondering if there is any way to convert the users input to lowercase letters.

3条回答
  •  有刺的猬
    2020-12-13 12:30

    There is a method called lowercaseString on NSString. NSString contains plenty of methods for string manipulation, please read the documentation.

    NSString *myString = @"Hello, World!";
    NSString *lower = [myString lowercaseString]; // this will be "hello, world!"
    

提交回复
热议问题