知识点
1.NSString 类的使用
2.NSMutableString 类的使用
=================================
NSString
0.NSString对象
1.为什么需要NSString对象
2.oc中字符串和c语言字符串的对比
1)输出方式
2)引用方式
NSString以@符号开头,表示该字符串是一个oc类型的字符串
c语言字符串则没有@开头
3.c语言字符串和NSString的转换
1)stringWithCString:encoding:消息
+方法 NSString *s2 = [NSString stringWithCString:"redHeartA" encoding:NSUTF8StringEncoding];
作用:将c字符串按照指定的编码方式转换为oc字符串对象
输出方式:使用NSLog的%@格式输出即可
2)UTF8String消息
-方法 const char *st2 = [s2 UTF8String];
作用:讲NSString对象按照UFT8编码转换为c字符串
并且转换的结果为一个const char *类型字符串
输出方式:要使用printf才可以输出
3)什么是字符编码
4.NSString的创建方式
1)根据现有的c字符串创建
2)stringWithFormat消息拼接字符串
+方法 NSString *s4 = [NSString stringWithFormat:@"%@%@", firstName, lastName];
作用:根据指定格式创建(类似c中的sprintf)
3)initWithUTF8String消息
作用:通过手动内存分配,并且以C字符串初始化NSString对象
4)stringWithString消息
作用:通过现有的NSString对象的到一个一样的字符串对象
5)copy消息
作用:通过拷贝的到一个一样的字符串对象
注意:通过4和5方法的到的字符串对象和源对象为同一个对象
=================================
NSString的常用方法
1.比较两个字符串是否相等
回忆:c语言中如何比较两个字符串是否相等
是否可以通过s1 == s2比较两个字符串相等
1)isEqualToString消息
作用:比较2个字符串是否相等,如果相等放回YES,不等返回NO
2.如何得到字符串的长度
NSUInteger len = [str length];
回忆:c语言中如何获取字符串的长度
1)length消息
//提取src中下标为4的字符
char ch = [src characterAtIndex:4];
NSLog(@"ch = %c", ch);
//提取最后一个字符
ch = [src characterAtIndex:[src length] - 1];
NSLog(@"ch = %c", ch);
作用:取得指定字符串对象的长度,返回NSUInteger
3.如何比较两个字符串的大小
回忆:c语言中如何对比两个字符串的大小
1)compare消息
作用:比较两个字符串对象的大小,返回一个NSComparisonResult的枚举结果
NSOrderedAscending = -1 表示左侧数值小于右侧;
NSOrderedSame = 0 则相等
NSOrderedDescending = 1 表示右侧数值小于左侧;
2)思考:如何忽略大小写比较
compare中的option属性
4.如何在一段字符串中提取出子串
1)characterAtIndex消息
作用:取出指定位置中的字符
2)substringFromIndex消息
作用:从指定位置开始向后提取字符串
3)substringToIndex消息
作用:提取从开头到指定位置的字符串
练习:1.提取从第9个字符开始到结束的子串
2.提取从开头到第9个字符的子串
思考:如何提取指定范围里的子串
4)NSRange结构体和NSMakeRange函数
作用:创建一个区间,用以告诉字符串对象要提取的子串范围
substringWithRange消息
作用:根据上述的区间提取出子串
5.如何在一段字符串中查找另一个字符串
1)rangeOfString消息
作用:查找目标指定字符串是否在目标字符串中
如果存在,返回的NSRange中会包含起始位置和长度
如不存在,NSRange.location == NSNotFound
6.如何对数字字符串进行运算
=================================
NSMutableString
1.为什么需要NSMutableString
2.NSMutableString和NSString的关系
3.如何创建一个NSMutableString对象
1)string消息
作用:创建一个空的可变字符串对象
=================================
NSMutableString的常用方法
1.如何重置NSMutableString的内容
1)setString消息
作用:将当前字符串中的内容设置为新的字符串
2.如何在字符串后面添加内容
1)appendString消息
作用:在当前字符串末尾追加新的字符串
2)appendFormat消息(类似sprintf函数)
作用:通过指定格式追加
3.如何在字符串中插入内容
1)insertString:atIndex消息
作用:将指定字符串插入到目标字符串指定位置
4.如何删除字符串中的内容
1)deleteCharactersInRange消息
作用:删除NSRange指定范围中的字符串
5.如何修改其中一段内容
1)replaceCharactersInRange:withString消息
作用:将NSRange指定范围中的字符串替换为指定内容
6.替换指定范围内所有出现的字符
- (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange;
代码-字符串
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
char str[20] = "hello world!";
printf("%s", str);
//编码 UTF-8(iOS) unico GBK
//通过构造函数 C -> OC
NSString *OCStr = [[NSString alloc] initWithCString:str encoding:NSUTF8StringEncoding];
//通过+方法
NSString *OCStr2 = [NSString stringWithCString:str encoding:NSUTF8StringEncoding];
NSLog(@"C->OC ===> %@, %@", OCStr, OCStr2);
// OC -> C 通过编码
//字面量的语法
NSString *OCStr3 = @"string";
const char *cStr2 = [OCStr3 UTF8String];
NSLog(@"OC->C ===> %s", cStr2);
//NSString 的创建
NSString *str1 = @"test";
//+ 通过格式化字符串来创建字符串(产生新的地址)
NSString *str2 = [NSString stringWithFormat:@"%@", str1];
//+ 通过其他字符串来创建字符串 (仅仅只是引用str1,因为地址相同)
NSString *str3 = [NSString stringWithString:str1];
//拷贝其他字符串来获得字符串
NSString *str4 = [str1 copy];
NSLog(@"str1:%p", str1);
NSLog(@"str2:%p", str2);
NSLog(@"str3:%p", str3);
NSLog(@"str4:%p", str4);
// str1 @"test" str2 @"test"
//比较字符串的地址,不能这样比较字符串!!
// if (str1 == str3)
//比较字符串是否相等
if ([str1 isEqualToString:str2])
{
NSLog(@"2个字符串相等");
}
else
{
NSLog(@"2个字符串不相等");
}
NSUInteger length = [str1 length];
NSLog(@"str1.length = %ld", length);
//字符串中获取指定下标的字符, 下标从0开始
char c = [str1 characterAtIndex:1];
NSLog(@"%c", c);
//获取字符串中最后一个字符
char lastChar = [str1 characterAtIndex:[str1 length] - 1];
NSString *strA = @"abcdef";
NSString *strB = @"abCdeg";
//比较字符串大小
NSComparisonResult result = [strA compare:strB];
if (result == NSOrderedAscending)
{
NSLog(@"strA < strB");
}
else if (result == NSOrderedSame)
{
NSLog(@"strA = strB");
}
else if (result == NSOrderedDescending)
{
NSLog(@"strA > strB");
}
//带条件的比较
// strA compare:strB options:(NSStringCompareOptions)
//字符串忽略大小的比较
NSComparisonResult res2 = [strA caseInsensitiveCompare:strB];
switch (res2) {
case NSOrderedAscending:
{
NSLog(@"strA < strB");
}
break;
case NSOrderedSame:
{
NSLog(@"strA = strB");
}
break;
case NSOrderedDescending:
{
NSLog(@"strA > strB");
}
break;
default:
break;
}
NSString *source = @"Hi, how are you?I'm fine,thank you!And you?";
// I 16 !35
NSString *des1 = [source substringFromIndex:16];
NSLog(@"%@", des1);
//下标是指结束的字符
NSString *des2 = [source substringToIndex:16];
NSLog(@"des2 ===%@===", des2);
//范围的结构体
//获取子字符串在源字符串的范围
NSRange range = [source rangeOfString:@"I"];
NSLog(@"loacation:%ld, length:%ld", range.location, range.length);
NSRange range2 = [source rangeOfString:@"!"];
NSLog(@"loacation:%ld, length:%ld", range2.location, range2.length);
//获取指定范围的子字符串2方法:::
//方法1:
// NSString *des3 = [source substringToIndex:range2.location + 1];
// NSString *des4 = [des3 substringFromIndex:range.location];
// NSLog(@"des4 ===%@===", des4);
//rang2.loaction - range.location = 字符串的长度
//方法2:
//创建一个范围的结构体
NSRange range3 = NSMakeRange(range.location, range2.location - range.location + range2.length);
//获取指定范围内的字符串
NSString *des5 = [source substringWithRange:range3];
NSLog(@"des5 ===%@===", des5);
//@"Hi, how are you?I'm fine,thank you!And you?"
//注意:查找的顺序,从头开始,遇到第一个匹配的字符串就停止
NSRange range4 = [source rangeOfString:@"you"];
NSLog(@"%@", NSStringFromRange(range4));
//NSNotFound 表示没有找到结果,
if (range4.location == NSNotFound)
{
//没有找到结果,千万不要使用range,否则crash
}
else
{
//表示找到结果,放心使用range
}
// 找到最后一个you的位置
/*
12
18 +1
7 +1
12 31 39
Hi, how are you?I'm fine,thank you!And you?
y|ou?I'm fine,thank you!And you?
y|ou!And you?
y|ou?
nsontfound;
*/
NSRange searchRange;
NSString *subString = source;
NSRange resultRange ;
do{
//查找you单词在上一次截取的子字符串中的范围
searchRange = [subString rangeOfString:@"you"];
if (searchRange.location != NSNotFound)
{
//截取子字符串,
subString = [subString substringFromIndex:searchRange.location + 1];
//累加上一次you的坐标
resultRange = NSMakeRange(searchRange.location +1 + resultRange.location, searchRange.length);
}
}while (searchRange.location != NSNotFound);
//因为第一次截取不需要偏移,所以最后要减1
NSLog(@"最后一个you的下标为:%ld", resultRange.location - 1);
NSString *numberString = @"123456";
//字符串转换为整型值
//转换到能够转换成数字的部分,其余部分不识别
//**开头如果为字母,直接转换成0**
NSInteger number = [numberString integerValue];
NSLog(@"number:%ld", number +1);
int number1 = [numberString intValue];
NSString *floatStr = @"1.23.456";
NSLog(@"%f", [floatStr floatValue]);
//字符串中是否包含子字符串
if ([source containsString:@"you"])
{
//表示有包含
}
else
{
//表示没有包含
}
}
return 0;
}
代码-可变字符串
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *string = @"hello world!";
//给字符串添加字符串
NSString *newStr = [string stringByAppendingString:@"test"];
NSLog(@"%@, %@", string, newStr);
NSMutableString *mutableString = [NSMutableString stringWithString:@"hello world!"];
//可变字符串添加字符串
[mutableString appendString:@"test"];
NSLog(@"%@", mutableString);
//可变字符通过格式控制添加
[mutableString appendFormat:@"%d", 1];
NSLog(@"%@", mutableString);
//插入字符串
[mutableString insertString:@"Hi" atIndex:6];
NSLog(@"%@", mutableString);
//在test前面插入@"aa"
NSRange range1 = [mutableString rangeOfString:@"test"];
if (range1.location != NSNotFound)
{
[mutableString insertString:@"aa" atIndex:range1.location];
}
NSLog(@"%@", mutableString);
//删除指定范围的内容
[mutableString deleteCharactersInRange:NSMakeRange(16, 4)];
NSLog(@"%@", mutableString);
// Hi, how are you?I'm fine, thank you, and you?
//替换指定范围内的内容
[mutableString replaceCharactersInRange:[mutableString rangeOfString:@"world"] withString:@"WORLDWORLD"];
NSLog(@"%@", mutableString);
NSMutableString *mStr = [NSMutableString stringWithString:@"Hi, how are you?I'm fine, thank you, and you?"];
//替换所有出现过的字符串 nil Nil null NULL = 0
[mStr replaceOccurrencesOfString:@"you" withString:@"me" options:0 range:NSMakeRange(0, [mStr length])];
NSLog(@"%@", mStr);
}
return 0;
}
//总结-代码区
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
#pragma make字符串创建
//快速创建一个字符串
NSString*string1=@"这是一个字符串常量";
NSLog(@"%@",string1);
//快速创建空字符串
NSString*string2=[[NSString alloc]init];
NSString*string3=[NSString string];
//快速创建一个字符串
NSString*string4=[[NSString alloc]initWithString:@"快速创建一个字符串"];
NSLog(@"%@",string4);
NSString*string5=[NSString stringWithString:@"快速创建一个字符串"];
NSLog(@"%@",string5);
//快速创建一个格式化字符串
int number=2;
NSString*string6=[[NSString alloc]initWithFormat:@"%d",number];
NSLog(@"%@",string6);
NSString*string7=[NSString stringWithFormat:@"%d",number];
NSLog(@"%@",string7);
NSString*str=[NSString stringWithUTF8String:"哈哈哈"];
NSLog(@"%@",str);
#pragma make比较两个字符创是否相等
NSString*string8=[NSString stringWithFormat:@"%d",number];
NSString *string9=[[NSString alloc]initWithFormat:@"%d",number];
//比较两个字符创是否相等if([Str1 isEquarToString:str2])
if ([string8 isEqualToString:string9]) {
NSLog(@"相同内容");
}else{
NSLog(@"不同内容");
}
#pragma mark比较两个字符串是否为同一个对象
NSString *string10=[NSString stringWithString:@"123"];
NSString *string11=[NSString stringWithString:@"123"];
if([string10 isEqualToString:string11]){
NSLog(@"相同内容");
}else{
NSLog(@"不同内容");
}
if(string10==string11){
NSLog(@"同一个对象");
}else{
NSLog(@"不同对象");
}
#pragma mark比较字符串的大小
NSString*string12=[NSString stringWithString:@"a"];
NSString*string13=[[NSString alloc]initWithString:@"b"];
//比较字符串的大小[str caseInsensitiveCompare:str1]返回一个NSComparisonResult类的变量
NSComparisonResult result=[string12 caseInsensitiveCompare:string13];
NSLog(@"%ld",result);//-1表示升序
#pragma mark求字符串的长度
NSString*string14=@"abcd";
NSLog(@"string14的长度:%ld",[string14 length]);
#pragma mark字符串的转换
//大写uppercaseString 小写lowercaseString 首字母大写capitalized
//[str 调用方法caseString];
NSString*string15=[[NSString alloc]initWithString:@"hello world!"];
NSLog(@"大写upper %@",[string15 uppercaseString]);
NSLog(@"小写lower %@",[string15 lowercaseString]);
NSLog(@"首字母大写capitalized %@",[string15 capitalizedString]);
#pragma mark 字符串转换成基本数据类型
//转换浮点型[str floatValue]
NSString*string16=[[NSString alloc]initWithString:@"3.14"];
NSLog(@"%.2f\n",[string16 floatValue]);
//转换数组[str componentsSeparatedByString:@""];
NSString*string17=[[NSString alloc]initWithString:@"abc def jhg"];
NSArray*array=[string17 componentsSeparatedByString:@""];
NSLog(@"%@",array);
#pragma mark字符串的截取
NSString*string18=@"abcdefg";
NSLog(@"%@",[string18 substringFromIndex:2]);//从第二位后开始取字符
NSLog(@"%@",[string18 substringToIndex:2]);//取两位结束
NSRange rang;
rang.location=2;
rang.length=3;
NSLog(@"%@",[string18 substringWithRange:rang]);//从第二位后开始取字符取三位字节长度
NSLog(@"%@",[string18 substringWithRange:NSMakeRange(2, 3)]);//等同上面
#pragma mark字符串的截取字符串的拼接:
//[str1 stringByAppendingString:str2]
NSString*string19=[[NSString alloc]initWithString:@"abc"];
NSString*string20=[NSString stringWithString:@"xyz"];
NSString*appstring1=[string19 stringByAppendingString:string20];
NSString*appstring2=[string19 stringByAppendingFormat:@"%@",string20];
NSLog(@"%@",appstring1);
NSLog(@"%@",appstring2);
#pragma mark字符串的查找:
NSString*string21=@"abcdffe-===fefjfwfw";
NSRange range1=[string21 rangeOfString:@"abcd"];
NSLog(@"%@",NSStringFromRange(range1));
if(range1.location != NSNotFound)
{ NSLog(@"found!"); }
//补充
NSString*str1=@"123456456.txt";
NSLog(@"是否以 123 开头:%i",[str1 hasPrefix:@"123"]);
NSLog(@"是否以 txt 结尾:%i",[str1 hasSuffix:@"text"]);
//从前向后搜索
NSRange rang1=[str1 rangeOfString:@"456"];
if (rang1.location==NSNotFound) {
NSLog(@"未找到");
}else{
NSLog(@"找到的范围是:%@",NSStringFromRange(rang1));
}
//从后向前搜索
rang1=[str1 rangeOfString:@"456" options:NSBackwardsSearch ];
NSLog(@"找到的范围是:%@",NSStringFromRange(rang1));
}
#pragma mark插入字符串
//[str insertString]
NSMutableString*MutableString=[[NSMutableString alloc]initWithString:@"abc"];
[MutableString insertString:@"xyz" atIndex:2];//从字符abc第二项插入=abxyzc
NSLog(@"%@",MutableString);
#pragma mark替换字符串
//取范围nsrange=nsmakerang(a,b);
[MutableString replaceCharactersInRange:NSMakeRange(0, 3) withString:@"itcase"];
NSLog(@"%@",MutableString);
#pragma mark删除字符串
[MutableString deleteCharactersInRange:NSMakeRange(0, 3)];
NSLog(@"%@",MutableString);
#pragma mark添加字符串
[MutableString stringByAppendingString:@"tianjia"];//拼接
NSLog(@"%@",MutableString);
#pragma mark 字符串截取
NSString *str5=@"123456789";
//从第6个位置开始截取
NSLog(@"%@",[str5 substringFromIndex:6]);
//截取到第6个位置
NSLog(@"%@",[str5 substringToIndex:6]);
//随便截取一段字符串
NSLog(@"%@",[str5 substringWithRange:NSMakeRange(1, 3)]);
NSString *str6=@"1-2-a-b-c";
//字符串分割
NSArray *array=[str6 componentsSeparatedByString:@"-"];
NSLog(@"%@",array);
#pragma mark 与路径相关
//快速创建一个自动释放的数组
NSMutableArray *array1=[NSMutableArray array];
[array1 addObject:@"User"];
[array1 addObject:@"Wildcat"];
[array1 addObject:@"APP"];
//通过一个数组创建一个路径字符串
NSString *path=[NSString pathWithComponents:array1];
NSLog(@"Path is:%@",path);
//把一个路径截取为数组
NSArray *apath=[path pathComponents];
NSLog(@"Array is;%@",apath);
//删除最后一个目录
NSLog(@"Array1 is;%@",[path stringByDeletingLastPathComponent]);
//拼接一个路径
NSLog(@"Array1 is;%@",[path stringByAppendingPathComponent:@"123.txt"]);
#pragma mark 其他用法
NSString *str7=@"123";
int a=[str7 intValue];//转化为整数
NSLog(@"%i",a);
//计算字数而不是字符数
NSLog(@"length=%zi",[@"我是字符串12345" length]);
//返回对应的字符
unichar c=[@"abc123" characterAtIndex:1];
NSLog(@"第2个字符是:%c",c);
//返回C语言字符串
const char *s=[@"abc" UTF8String];
NSLog(@"C语言字符串是:%s",s);
return 0;
}
练习
1.
str1 = @“my name is”
str2 = @“John shang”
str3 = @“I am 45”
拼接到str4
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
//1.
NSString *str1 = @"my name is";
NSString *str2 = @"John shang";
NSString *str3 = @"I am 45";
// NSString *str4 = [NSString stringWithFormat:@"%@ %@ %@", str1, str2, str3];
// NSString *str4 = [[str1 stringByAppendingString:str2] stringByAppendingString:str3];
// NSLog(@"%@", str4);
NSMutableString *str4 = [NSMutableString stringWithString:str1];
[str4 appendString:str2];
[str4 appendString:str3];
NSLog(@"%@", str4);
}
return 0;
}
2.现有字符串@“When I was young, I loved a girl on neighbor class”
不直接数下标来获得 was 到girl。
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
//2
NSString *source = @"When I was young, I loved a girl on neighbor class";
NSRange range1 = [source rangeOfString:@"was"];
NSRange range2 = [source rangeOfString:@"girl"];
NSString *result = nil;
if ((range1.location != NSNotFound) && (range2.location != NSNotFound))
{
result = [[source substringToIndex:range2.location + range2.length] substringFromIndex:range1.location];
}
NSLog(@"==%@==", result);
}
return 0;
}
作业
1. 输入一个字符串 例如 “iphoneAndroid” 将Android从字符串中删掉,打印剩下的字符串
2.求字符串 “158”和“39”按十进制做差后的结果以字符串形式输出
3.取出符串“123-456-789-000”中的数字部分,组成一个新的字符串输出
4.现有字符串@“When I was young, I loved a girl on neighbor class” 从young 到 girl, 改成@“teacher, I ranther teaching the students”
5.解析:[02:30.63]握你的双手感觉你的温柔
得出秒数和歌词,并按格式输出结果:总时间:xxxs,歌词为 xxxxx
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
#pragma make输入一个字符串 例如 “iphoneAndroid” 将Android从字符串中删掉,打印剩下的字符串
NSMutableString*mutableString=[[NSMutableString alloc]initWithString:@"iphoneAndroid"];
// [mutableString deleteCharactersInRange:NSMakeRange(6, 7)];
// NSLog(@"%@",mutableString);
NSLog(@"%@",[mutableString substringToIndex:6]);
#pragma make求字符串 “158”和“39”按十进制做差后的结果以字符串形式输出
NSString*string1=[[NSString alloc]initWithString:@"158"];
NSString*string2=[[NSString alloc]initWithString:@"39"];
NSInteger a1=[string1 integerValue];
NSInteger a2=[string2 integerValue];
NSInteger minus=a1-a2;
NSLog(@"%i",minus);
#pragma make取出符串“123-456-789-000”中的数字部分,组成一个新的字符串输出
NSMutableString*mutableString1=[[NSMutableString alloc]initWithString:@"123-456-789-000"];
for (int i=2; i>0; i--) {
NSRange rang=[mutableString1 rangeOfString:@"-"];
[mutableString1 deleteCharactersInRange:rang];
NSRange rang1=[mutableString1 rangeOfString:@"-"];
}
NSRange rang1=[mutableString1 rangeOfString:@"-"];
[mutableString1 deleteCharactersInRange:rang1];
NSLog(@"%@",mutableString1);
// NSLog(@"%@",mutableString1);
#pragma make现有字符串@“When I was young, I loved a girl on neighbor class” 从young 到 girl, 改成@“teacher, I ranther teaching the students”
NSMutableString*MutableString2=[[NSMutableString alloc]initWithString:@"When I was young, I loved a girl on neighbor class"];
[MutableString2 deleteCharactersInRange:NSMakeRange(10, 22)];
[MutableString2 insertString:@"teacher, I ranther teaching the students" atIndex:10];
NSLog(@"%@",MutableString2);
//方法二
NSRange range1=[MutableString2 rangeOfString:@"young"];
NSRange range2=[MutableString2 rangeOfString:@"girl"];
if (rang1.location!=NSNotFound&&range2.location!=NSNotFound) {
NSRange range=NSMakeRange(range1.location, range2.location-range1.location+range2.location);
[MutableString2 replaceCharactersInRange:range withString:@"teacher, I ranther teaching the students"];
}
NSLog(@"%@",MutableString2);
#pragma make解析:[02:30.63]握你的双手感觉你的温柔,得出秒数和歌词,并按格式输出结果:总时间:xxxs,歌词为 xxxxx
NSString*lrc=@"[02:30.63]握你的双手感觉你的温柔";
/*
#import
int main(int argc, const char * argv[]) {
@autoreleasepool {
//1.
NSString *str1 = @"my name is";
NSString *str2 = @"John shang";
NSString *str3 = @"I am 45";
// NSString *str4 = [NSString stringWithFormat:@"%@ %@ %@", str1, str2, str3];
// NSString *str4 = [[str1 stringByAppendingString:str2] stringByAppendingString:str3];
// NSLog(@"%@", str4);
NSMutableString *str4 = [NSMutableString stringWithString:str1];
[str4 appendString:str2];
[str4 appendString:str3];
NSLog(@"%@", str4);
//2.
NSString *source = @"When I was young, I loved a girl on neighbor class";
NSRange range1 = [source rangeOfString:@"was"];
NSRange range2 = [source rangeOfString:@"girl"];
NSString *result = nil;
if ((range1.location != NSNotFound) && (range2.location != NSNotFound))
{
result = [[source substringToIndex:range2.location + range2.length] substringFromIndex:range1.location];
}
NSLog(@"==%@==", result);
}
return 0;
}
*/
}
return 0;
}