字符串与List互转】的更多相关文章

将逗号分隔的字符串与List互转 方法 1: 利用JDK的Arrays类String str = "a,b,c";List<String> result = Arrays.asList(str.split(",")); 方法 2: 利用Guava的SplitterString str = "a, b, c";List<String> result = Splitter.on(",").trimResul…
json字符串和dict互转 import json str = '{"params":[{"id":222,"offset":0},{"nodename":"topic"}]}' params = json.loads(str) print(params)…
iOS开发--字典(NSDictionary)和JSON字符串(NSString)之间互转 1. 字典转Json字符串 // 字典转json字符串方法 -(NSString *)convertToJsonData:(NSDictionary *)dict { NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error…
date的详细用户可以参考下面的 http://www.cnblogs.com/xd502djj/archive/2010/12/29/1919478.html date 的具体用法可以查看另外一篇博文 <shell date 命令详解>http://blog.csdn.net/runming918/article/details/7223520 date +%s   可以得到UNIX的时间戳;用shell将时间字符串与时间戳互转:      date -d "2010-10-18…
十六制字符串jpg图片互转(格式:FFD8FFE000104A******)如:FFD8FFE000104A46494600010100000100010000FFDB004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C180D0D1832…
# -*- coding: gbk -*- import re #将数字格式化为带三位数逗号的字符串 def formatNumber(number): numStr='%d'%number formatStr='' numStr=numStr[::-1] i=0 while i<len(numStr): formatStr+=numStr[i] i+=1 if i%3==0: formatStr+=',' formatStr=formatStr.strip(',') formatStr=for…
--将行转为字符串 select stuff((select top 20 ','+ QQ from dl_QQ where uiid=1 order by tim desc for xml path('')),1,1,'') -- ============================================= -- Description: 将字符串转为表格 /* 例:select * from [f_split]('spu0987*5//spu0988*5/spu0989*5',…
1.字符串转数组 这个相信多数人都会常用,string.split方法,分隔符可以为多个.详细信息参见MSDN string[] actionCfgs = _para.Split(new char[]{cm_defaultSeparator}); 2.字符串数组转固定分隔符字符串 这个就不知道有多少人经常使用了.String.Join 详见MSDN string[] tempS= new string[]{"a","b","c"}; Consol…
#pragma mark 转换json字符串 +(NSString *)toJSON:(id)aParam { NSData   *jsonData=[NSJSONSerialization dataWithJSONObject:aParam options:NSJSONWritingPrettyPrinted error:nil]; NSString *jsonStr=[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEn…
小米JS地址: http://p.www.xiaomi.com/zt/20130313/huodong/pm.min.js 上面这个JS是小米抢手机页面的代码.和抢手机有直接关联.. 虽然我3次都没抢到红米手机,但是今天偶尔发现这么一个js文件,对文件内容比较好奇,但是这个js开头有个数组,部分截图如下: 开始这么一大堆的16进制字符串,这种类型的数据经常会在properties文件中看到,为了看到实际的内容,写了如下代码进行翻译. 最简单的方式,只要把上面的代码,贴到浏览器(如chrome的c…