public static String ConvertToPinyin(String str) { if (String.IsNullOrEmpty(str)) return String.Empty; var sb = new Strin...
单例模式保证一个类中只有一个实例且该实例易于外界访问。懒汉模式(第一次调用的时候实例化,懒加载)public class SingletonClass{ private static SingletonClass instance=null; public static synchron...
分类:
编程语言 时间:
2015-12-16 15:22:49
阅读次数:
140
遍历方式1: public static void printArray(int[] arr) { for(int x=0; x max); max = arr[x]; } return max; }最小值 p...
分类:
编程语言 时间:
2015-12-16 15:22:46
阅读次数:
200
class Program { public delegate int Run(int i, int j); public static void Main(string[] args) { MainFunction(Add);...
1 public class SingleInstance 2 { 3 private static SingleInstance singleInstance = null; 4 private static readonly object locker = new object(); 5 pr....
分类:
其他好文 时间:
2015-12-16 12:06:39
阅读次数:
151
OC 中单例的使用+ (instancetype)sharedManager { static id instance; static dispatch_once_t onceToken; NSLog(@"%ld", onceToken); dispatch_once(&on...
分类:
编程语言 时间:
2015-12-16 01:43:00
阅读次数:
213
step 1:写一个java类,定义一个或多个public static 方法,在方法中实现函数的逻辑step 2:在.tld文件中描述该函数可以参考fn.tldstep 3:在jsp文件中,导入并使用函数如,java类如下:1 package myfunc;2 3 public class MyE...
分类:
其他好文 时间:
2015-12-16 00:30:04
阅读次数:
155
private static boolean arrEquals(byte[] a1, byte[] a2) { if (a1 == a2) return true; if (a1 == null || a2 == null) ...
分类:
其他好文 时间:
2015-12-15 22:55:38
阅读次数:
383
逐行写入文本 public class TestFileWriter { public static void main(String[] args) { FileWriter fw = null; try { fw = new FileWriter("d://test.txt",true)...
分类:
编程语言 时间:
2015-12-15 22:30:59
阅读次数:
622
JOptionPane 有助于方便地弹出要求用户提供值或向其发出通知的标准对话框。但是有时候看看API也特别烦,因为方法多,参数多,特别难记忆。这里我给出几种常用的方法供大家参考。 (1) public static int showConfirmDialog(ComponentparentC...
分类:
编程语言 时间:
2015-12-15 21:13:36
阅读次数:
366