小编Hav*_*Lin的帖子

componentsSeparatedByString返回错误的结果

我用这段代码来剪切字符串

    NSString *titleString = @"22.225453615805794,113.554006577014889";
    NSArray *array = [titleString componentsSeparatedByString:@","];
    NSLog(@"title string %@", titleString);
    NSLog(@"first %.15f", [[array objectAtIndex:0] floatValue]);
    NSLog(@"second %.15f", [[array objectAtIndex:1] floatValue]);
Run Code Online (Sandbox Code Playgroud)

但为什么它会回来

22.225454330444336和113.554008483886719

iphone xcode nsstring ios

4
推荐指数
1
解决办法
574
查看次数

标签 统计

ios ×1

iphone ×1

nsstring ×1

xcode ×1