如何在目标c中使用strlen查找字符串长度 [英] how to find string length using strlen in objective c

查看:106
本文介绍了如何在目标c中使用strlen查找字符串长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在str变量中有一个字符串我希望找到str变量中可用的字符串长度

i have a string strored in str variable i want to find string length which is available in str variable

我尝试使用strlen(str);它不起作用...

i hav tried with strlen(str); its not working...

推荐答案

如果您的字符串是C-String,那么您可以使用 strlen(str)

If your string is a C-String, then you can use strlen(str).

如果它是 NSString * str ,那么你可以使用 NSUInteger length = [str length];

If it is a NSString *str, then you can use NSUInteger length = [str length];

这篇关于如何在目标c中使用strlen查找字符串长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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