//DataTable转String方法 public static String DataTable2String(DataTable dt) { string strXML = "\r\n"; try { ...
ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number
of rows like this: (you may want to display this pattern in a fixed font for better legibility)
P...
分类:
其他好文 时间:
2015-04-17 15:49:24
阅读次数:
144
我们在Java中如果用到处理要分隔字符串,不免会用到String的split(String regex)函数,这时候我们要注意的。
如果想以回车来分隔字符串,很多同学都会这样做。下面是例子:
String[] res = str.split("\n");
但是这样可能会有一个潜在的问题,如果我们的str字符串是从文本文件中得到的,那么就会出现一个隐患。
假如我们的文件为test.txt,里...
分类:
编程语言 时间:
2015-04-17 15:48:02
阅读次数:
141
String to Integer (atoi)
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself ...
分类:
其他好文 时间:
2015-04-17 15:46:41
阅读次数:
133
在app开发过程中,经常需要显示media文件的meta data信息,我们如何获取这些信息呢?
MediaStore
首先想到的就是MediaStore类了,它为我们提供的丰富的属性,我们只要通过sqlite操作,就能获取这些属性提供的值啦。
public static final String[] ItemImageProjection = new String[] {
Me...
分类:
移动开发 时间:
2015-04-17 15:39:04
阅读次数:
343
请看一下代码import java.util.*;class book{ static int c = null;}public static void main(String[] args){ Book book1 = new book(); Book book2 = new book();...
分类:
编程语言 时间:
2015-04-17 15:31:10
阅读次数:
207
public static void main(String[] args) {
System.out.println(methodC("abccbazx"));
System.out.println(methodC("abccbaz"));
System.out.println(methodD("abccbazx",0));
System.out.println(m...
分类:
其他好文 时间:
2015-04-17 14:02:31
阅读次数:
135
Longest Palindromic Substring
Given a string S,
find the longest palindromic substring in S.
You may assume that the maximum length of S is
1000, and there exists one unique longest palindrom...
分类:
其他好文 时间:
2015-04-17 13:55:59
阅读次数:
162
1.使用多线程的几种方式(1)不需要传递参数,也不需要返回参数ThreadStart是一个委托,这个委托的定义为void ThreadStart(),没有参数与返回值。复制代码 代码如下:class Program { static void Main(string[] args) { for (i...
分类:
编程语言 时间:
2015-04-17 13:47:46
阅读次数:
146
不好意思!但是现在这个程序比上次那个好多了,而且没有重复,程序看起来比较简练,以下是新程序:#include#includeusing namespace std;class consumer{public:void int_consumer(string N ,string I,string P,...
分类:
其他好文 时间:
2015-04-17 13:46:25
阅读次数:
140