在Objective-C中将所有文本转换为小写 [英] Converting all text to lower case in Objective-C

查看:124
本文介绍了在Objective-C中将所有文本转换为小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用中有一个文本字段,用户应输入一些文字。但我想知道是否有任何方法可以将用户输入转换为小写字母。

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.

我记得在C#中它类似于 Convert.ToLower 但我似乎无法弄清楚如何在Objective-C中做到这一点。

I remember in C# it was something like Convert.ToLower but I can't seem to figure out how to do it in Objective-C.

推荐答案

NSString 上有一个名为 lowercaseString 的方法。 NSString 包含大量字符串操作方法,请阅读文档

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!"

这篇关于在Objective-C中将所有文本转换为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆