在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
int main(int argc, const char * argv[]) { @autoreleasepool { NSString *outputString = @"1234567890!@#$%^&*()"; NSMutableString *resultString = [[NSMutableString alloc] init]; NSLog(@"%d", (int)outputString.length); for(int j=0;j<outputString.length;j++) { NSLog(@"Index = %d Char = %@",j, [outputString substringWithRange:NSMakeRange(j, 1)]); } for(int i=0;i<20;i++) { int index = arc4random() % outputString.length; NSString *indexString = [outputString substringWithRange:NSMakeRange(index, 1)]; [resultString appendFormat:@"%d %@ ", index, indexString]; } if (resultString) { NSLog(@"%@", resultString); } return 0; } }
|
请发表评论