字符串大小写变更:
NSString的定义变更情,基本上提供了三种方法的NSString类型的更改大小写
1。)lowercaseString:将改变成小写的字符串
2)uppercaseString:。字符串将改为大写
3。)capitalizedString:使用它,改变字符串的第一个字符的情况下帽
NSString *string1 = @"ROSE INDIA";
本地化字符串:
SLocalizedString(@"Pull down to refresh...", @"Pull downto refresh status");
在源代码中使用NSLocalizedString来引用国际化文件
//括号里第一个参数是要显示的内容,与各Localizable.strings中的id对应
//第二个是对第一个参数的注释,一般可以为空串
[_alertView setTitle:NSLocalizedString(@"Submitted successfully",@"")];
把数字及“|”全部用空格来替换,这个怎么换
NSCharacterSet *cs = [NSCharacterSetcharacterSetWithCharacte
NSString *resultstr = [[yourstrcomponentsSeparatedByCha
字符串的截取和查找
[starttimesubstringWithRange:NSMakeRange(0,3)]
//从starttime的第0位开始,截取3个字符串长度
[allnum rangeOfString:@"ab"].location ==NSNotFound
//在allnum中查找ab,返回BOOL类型
忽略2个字符串的大小写,再判断他们是否相等的
果您要在忽略大小写的情况下比较2个字符串是否相等,比如 (@"vvv"==@"Vvv") = true;如果每次都转换大小写再比较的话,会很麻烦。下面提供2个忽略大小写时比较字符串是否相等的方法将NSString类型的数据转换成NSData:
NSData*webData = [NSMutableData dataWithBytes:[theXML UTF8String]length:[theXML length]];//theXML为NSString类型
将NSDate类型数据转化成NSString
NSString *theXML =[[NSString alloc] initWithBytes: [webData mutableBytes]length:[webData length]encoding:NSUTF8StringEncoding];
//webData为NSData类型