OC

获取字符串中的数字

920 发布: 2017/7/12 02:01 本文总阅读量
获取字符串中的数字
- (NSString *)getNumberFromStr:(NSString *)str {

    NSCharacterSet *characterSet = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
    return[[str componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""];

}