首页 > 其他 > 详细

How to check if NSString begins with a certain character

时间:2014-07-14 20:51:41      阅读:352      评论:0      收藏:0      [点我收藏+]

How to check if NSString begins with a certain character

How do you check if an NSString begins with a certain character (the character *).

The * is an indicator for the type of the cell, so I need the contents of this NSString without the *, but need to know if the * exists.

You can use the -hasPrefix: method of NSString:

NSString* output = nil;
if([string hasPrefix:@"*"])
    output = [string substringFromIndex:1];

 

How to check if NSString begins with a certain character,布布扣,bubuko.com

How to check if NSString begins with a certain character

原文:http://www.cnblogs.com/savagemorgan/p/3842672.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!