惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
H
Help Net Security
小众软件
小众软件
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
爱范儿
爱范儿
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园 - 【当耐特】
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
博客园_首页
Jina AI
Jina AI
D
Docker
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志

博客园 - K3

什么是URL,URI或URN? 软件设计思想的一些文章 (持续补充中) Mac OS X 上Lua的安装方法 Objective C - 4 - 下载图片并且加载到View Objective C - 3 - 实现一个计算器 Objective C - 1 - 实现一个MessageBox.Show MySQL 存储过程,游标,临时表创建 List connected users–similar to task manager How to compose namespaces? Hide/Show running Console Calculate drive total/free/available space C# list installed softwares How to: Modify a Project System So That Projects Load in Multiple Versions of Visual Studio PS:WINRAR制作32位安装程序和64位安装程序选项 使用WINRAR来制作安装程序 impersonate a user VBScript - CUD registry key and value mysql script for dynamic running sql script XmlElement可以避免由XmlSerializer多余生成的代码
Objective C - 2 - 随机数,可变字符串,字符串,SubString
K3 · 2014-05-27 · via 博客园 - K3
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;
    }
}