先放到博客里面,以备之后使用的时候查看 ^ ^int i=2;方法1:Console.WriteLine(i.ToString("D5"));方法2:Console.WriteLine(i.ToString().PadLeft(5,'0'));方法3:Console.WriteLine(i.ToSt...
1实现一个类MyInputStream读取文件,且不能抛出异常public class TestDemo { public static void main(String[] args) throws Exception { InputStream in = new MyInpu...
分类:
编程语言 时间:
2015-04-08 12:43:54
阅读次数:
156
/// /// 设置session /// /// session 名 /// session 值 public static void SetSession(string name, object val) ...
String类指向不可变对象,一旦修改String类的值,则创建新的对象,释放旧的对象。StringBuffer类可以修改对象的值。StringBuffer的创建需要 StringBuffer sb = new StringBuffer();如果在程序中频繁进行修改链接操作的话,StringBuff...
分类:
其他好文 时间:
2015-04-08 12:30:27
阅读次数:
135
得到一个string序列的最长公共前缀。【思路】先求得最小string的长度,使得比较次数尽可能少。对于要返回的prefix的每一位,从第一个string中取一个字符,拿来和其他string同样位置的字符比较;如果不相同,则返回当前的prefix,否则添加到prefix后。【注意】读取第i个stri...
分类:
其他好文 时间:
2015-04-08 10:50:46
阅读次数:
81
中文转Unicode:HttpUtility.UrlEncodeUnicode(string str); 转换后中文格式:"%uxxxx" 举例:"柳_abc123" 转换结果是:"%u67f3_abc123"Unicode转中文1:HttpUtility.UrlDecode(string str)...
分类:
Web程序 时间:
2015-04-08 10:50:20
阅读次数:
2497
题目地址:https://leetcode.com/problems/wildcard-matching/动态规划解答:public class Solution { public boolean isMatch(String s, String p) { if(p.length...
分类:
其他好文 时间:
2015-04-08 10:35:44
阅读次数:
145
public class TestString{ public static void main(String[] args){ char c[] = {'s','u','n','j','a','v','a'}; String s1 = new String(c); String s2 = n...
分类:
其他好文 时间:
2015-04-08 10:27:54
阅读次数:
117
public class TestStringBuffer{ public static void main(String[] args){ System.out.println("************"); String s1 = "hello"; String s2 = "world"...
分类:
其他好文 时间:
2015-04-08 10:26:35
阅读次数:
118
public class Main {
static final int MAXVEX =65535;
static final int MINVEX =65535;
public static void main(String[] args) {
MyGrop2 p = new MyGrop2();
new Main().MiniSpanTree(p);
}
static in...
分类:
其他好文 时间:
2015-04-08 09:21:39
阅读次数:
109