今天遇到截取字符串的问题,在网上查了IndexOf、LastIndexOf、Substring这三种截取字符串的使用总结如下: String.IndexOf String.IndexOf 方法 (Char, Int32, Int32)报告指定字符在此实例中的第一个匹配项的索引。搜索从指定字符位置开始...
分类:
其他好文 时间:
2014-09-10 15:34:40
阅读次数:
217
/**
*判断str中是否含有中文,有则返回true,否则返回false
*
*@paramstr
*@return
*/
privatebooleanisChineseCharacter(Stringstr){
for(inti=0;i<str.length();i++){
if(str.substring(i,i+1).matches("[\\u4e00-\\u9fbb]+")){
returntrue;
}
}
returnfalse;
}
分类:
其他好文 时间:
2014-09-10 14:19:31
阅读次数:
186
/*
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
["aa","b"],
["a","a"...
分类:
其他好文 时间:
2014-09-10 12:33:50
阅读次数:
175
function getURL(){ var args = {}; var query = location.search.substring(1); //获得了当前链接的中?号后的参数 var pairs = query.split("&"); for(var i = 0; i < pairs.....
分类:
Web程序 时间:
2014-09-10 12:12:30
阅读次数:
202
Palindrome Partitioning
Total Accepted: 18096 Total
Submissions: 69797My Submissions
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all...
分类:
其他好文 时间:
2014-09-09 18:29:29
阅读次数:
205
在Java中我们无须关心内存的释放,JVM提供了内存管理机制,有垃圾回收器帮助回收不需要的对象。但实际中一些不当的使用仍然会导致一系列的内存问题,常见的就是内存泄漏和内存溢出
内存溢出(out of memory ):通俗的说就是内存不够用了,比如在一个无限循环中不断创建一个大的对象,很快就会引发内存溢出。
内存泄漏(leak of memory):是指为一个对象分配内存之后,在对象已经不在使...
分类:
编程语言 时间:
2014-09-09 16:09:59
阅读次数:
222
1、$position = index(string,substring,skipchars); 该函数返回子串substring在字符串string中的位置,如果不存在,则返回-1;参数skipchars是可选参数,表示查找之前跳过的字符数,即:从该位置处开始查找;2、rindex(string,...
分类:
其他好文 时间:
2014-09-09 15:46:08
阅读次数:
147
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 longes...
分类:
其他好文 时间:
2014-09-09 12:14:08
阅读次数:
200
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2014-09-09 11:49:38
阅读次数:
167
Substring with Concatenation of All Words...
分类:
其他好文 时间:
2014-09-07 14:49:15
阅读次数:
166