Swift中,数组Array和字典Dictionary是用结构来实现的,但是数组与字典和其它结构在进行赋值或者作为参数传递给函数的时候有一些不同。并且数组和字典的这些操作,又与Foundation中的NSArray和NSDictionary不同,它们是用类来实现的。注意:下面的小节将会介绍数组,字典...
分类:
其他好文 时间:
2014-06-18 11:11:15
阅读次数:
256
说到swift的集合类型,就不得不谈到Dictionary。包含一个键值对组合的集合。var air = ["name":"warner","title":"Math"]var air = Dictionary(minimumCapacity:3)都可以初始化Dictionary。在swift中,....
分类:
其他好文 时间:
2014-06-18 10:55:42
阅读次数:
192
1、Ip地址验证/// /// Ip地址验证 /// public static bool CheckIp(string ip) { bool result = false; Regex ipReg = new Regex(@"^(\d{1,2}|1\d\d|2[0-...
分类:
其他好文 时间:
2014-06-18 10:35:56
阅读次数:
193
题目
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
方法
public int romanToInt(String s) {
HashMap hm = new H...
分类:
其他好文 时间:
2014-06-17 19:27:48
阅读次数:
324
3DES是继DES容易被破解后的DES加密升级版,它属于对称加密。可指定24位长度的密钥,在java API中也有其实现,代码如下:
/**
* 3DES 的Java SDK API 实现
* @author dxd
* 201406917
*/
public class DES3 {
private static final String Algorithm = "DESede";/...
分类:
其他好文 时间:
2014-06-17 18:57:36
阅读次数:
187
在Android的日常开发中,相信大家都用过SharedPreferences来保存用户的某些settings值。Shared Preferences
以键值对的形式存储私有的原生类型数据,这里的私有的是指只对你自己的app可见的,也就是说别的app是无法访问到的。
客户端代码为了使用它有2种方式,一种是通过Context#getSharedPreferences(String prefNam...
分类:
移动开发 时间:
2014-06-17 18:56:59
阅读次数:
350
importjava.util.Calendar;
publicclassCalendarTest
{
/**
*Jun16,2014
*/
publicstaticvoidmain(String[]args)
{
//TODOAuto-generatedmethodstub
Calendarc=Calendar.getInstance();//默认由当前的日期和时间初始化
System.out.println(c.getClass().getNam..
分类:
其他好文 时间:
2014-06-17 18:34:21
阅读次数:
202
python模块——hashlibhashlib模块是对许多hash函数的一个公共接口new(name,string=‘‘)执行给定的hash函数来返回一个新的hash对象,使用给定的字符串数据初始化hash对象。如:>>>importhashlib
>>>hashlib.new(‘md5‘,string=‘abc‘).hexdigest()#hexdigest()..
分类:
编程语言 时间:
2014-06-17 18:11:38
阅读次数:
215
importjava.text.DecimalFormat;
publicclassDecimalFormatTest
{
publicstaticvoidmain(String[]args){
DecimalFormatdf1,df2;
System.out.println("整数部分0/#的区别");
df1=newDecimalFormat("#.00");
df2=newDecimalFormat("0.00");
System.out.p..
分类:
其他好文 时间:
2014-06-17 17:32:15
阅读次数:
249
题目
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
方法
/*语法:
*(1)基本数字I,X,C中的任何一个连用构成数目,都不能超过三个;
* 放在大数的左边只能用一个。
(2)基...
分类:
其他好文 时间:
2014-06-17 16:33:27
阅读次数:
217