如何使用NSString结构体
来源:互联网 发布:mysql数据库引擎 编辑:程序博客网 时间:2024/06/06 15:38
// 处理这个纪录
A_Record record_one;
record_one = [selfget_one_from_html: str_one_record ];
函数:
-(A_Record )get_one_from_html:(NSString *)one_record
{
A_Record record_one;
NSString *record=@"";
record = [one_recordsubstringFromIndex:2];
if([recordrangeOfString:@"],"options:NSCaseInsensitiveSearch].location !=NSNotFound)
{
if(((one_record.length -4)>0) || ((one_record.length -4)==0))
{
record = [recordsubstringToIndex:one_record.length -4];
}
else
{
record =@"";
}
}
elseif([record rangeOfString:@"]"options:NSCaseInsensitiveSearch].location !=NSNotFound)
{
if(((record.length -2)>0) || ((record.length -2)==0))
{
record = [recordsubstringToIndex:record.length -2];
}
else
{
record =@"";
}
}
NSString *find_start = @",";
NSRange foundRange_start = [record rangeOfString:find_start options:NSCaseInsensitiveSearch];
NSString *str_rest = @"";
int pos_start = 0;
NSString *str1 = @"";
NSString *str2 = @"";
NSString *str3 = @"";
int i_count =0;
while (foundRange_start.location !=NSNotFound)
{
i_count++;
pos_start = foundRange_start.location + foundRange_start.length +1;
if(1 == i_count)
{
if((pos_start-3)>=0)
{
str1 = [recordsubstringToIndex:pos_start-3];
}
else
{
str1 =@"";
}
}
else if(2==i_count)
{
if((pos_start-3)>=0)
{
str2 = [recordsubstringToIndex:pos_start-3];
}
else
{
str2 =@"";
}
}
// 开始下一个
str_rest = [recordsubstringFromIndex:pos_start];
record =str_rest;
foundRange_start = [recordrangeOfString:find_start options:NSCaseInsensitiveSearch];
}
int pos_location_last = record.length-3;
if(pos_location_last>0)
{
str3 = [recordsubstringToIndex:pos_location_last];
}
else if(pos_location_last<=0)
{
str3 =@"";
}
if(str3.length ==0)
{
str3 =@"NULL";
}
else
{
str3= [str3 stringByReplacingOccurrencesOfString:@"|"withString:@"!"];
}
if(str2.length ==0)
{
str2 = str3;
}
record_one.id =str1;
record_one.name =str2;
record_one.number =str3;
return record_one;
}
- 如何使用NSString结构体
- 如何使用struct_finddata_t结构体
- Foundation框架—结构体、NSString
- NSString使用
- NSString 使用
- NSString使用
- NSString使用
- 结构体如何使用NSData包装
- 如何在MAP中使用结构体
- 结构体如何使用NSData包装
- 黑马程序员-OC笔记(八) Foundation 结构体 NSString
- 黑马程序员 OC语言 - 7 结构体、NSString、NSArray、NSMutableArray
- OC基础-Foundation框架-0321-常见结构体和NSString
- 黑马程序员----OC Foundation框架--结构体、NSString
- NSDATA如何转成NSString
- 【C++】如何使用嵌套结构
- 如何使用NSValue 类型包含C结构体
- 如何使用宏求结构体的内存偏移地址
- Unity3D内存管理
- 使用Tcl脚本分配FPGA管脚
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
- How to create a custom directory for app files inside the ~/Library/Application Support directory.
- 用valgrind检查内存情况的命令
- 如何使用NSString结构体
- [转载]VC对话框背景颜色、控件颜色
- html、css的初级认知
- Python strip lstrip rstrip使用方法
- 11.Spring + Hibernate + JPA
- Markdown中插入数学公式的方法
- jQuery Event add [ 源码分析 ]
- Android 百度地图开发如何设置地图中心点
- D客微信 永久免费、轻松分享