开发者

NSString Character found

开发者 https://www.devze.com 2023-02-26 14:06 出处:网络
I have on n开发者_StackOverflowsstring object in which sometimes phone number gets stored and sometimes email address, i just need to ask that how to find any character suppose @ in a string, when ema

I have on n开发者_StackOverflowsstring object in which sometimes phone number gets stored and sometimes email address, i just need to ask that how to find any character suppose @ in a string, when email address is typed.


This is how you could check for @ as a substring

if ([string rangeOfString:@"@"].location == NSNotFound) {
  // Number
} else {
  // Email
}
0

精彩评论

暂无评论...
验证码 换一张
取 消