String.IndexOfString.IndexOf 方法 (Char, Int32, Int32)报告指定字符在此实例中的第一个匹配项的索引。搜索从指定字符位置开始,并检查指定数量的字符位置。String.IndexOf(value, startIndex, count)参数value:要查找...
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-08-18 18:02:56
阅读次数:
198
(1)subString是否始终返回一个新串? 事实并非如此,subString只有在截取的子串是真子串(真子串指子串与原串不相同)时才会返回一个新声明的子串。当截取的是整个字符串时,则返回自身,具体可参考源码: subString方法用来截取子串,方法的使用有两种形式String subStr.....
分类:
其他好文 时间:
2015-08-18 16:09:03
阅读次数:
111
substrsubstr(start,length)表示从start位置开始,截取length长度的字符串。var src="images/pic_1.png";alert(src.substr(7,3));弹出值为:picsubstringsubstring(start,end)表示从start到...
分类:
其他好文 时间:
2015-08-18 11:51:07
阅读次数:
112
背景
最近开始研究算法,于是在leetcode上做算法题,第五题Longest Palindromic Substring便是关于回文子串的。
什么是回文字串
回文字符串是指将该字符串前后颠倒之后和该字符串一样的字符串。例如:a,aaaa,aba,abba…
最长回文子串
要求最长回文子串,就需要遍历每一个子串,时间复杂度是O(N²);判断字串是不是回文,时间复杂度是...
分类:
编程语言 时间:
2015-08-18 10:18:51
阅读次数:
172
String s = "abcdef";通过s.indexOf("c")函数,会返回一个int类型的索引值,此值代表字符“c”在此字符串中第一次出现的c的位置。s.lastIndexOf("c")函数,会返回最后一个出现“c”的位置subString代表了截取字符串的函数s.subString(in...
分类:
其他好文 时间:
2015-08-17 11:33:34
阅读次数:
99
题目
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without
repeating letters for "abcabcbb" is "abc", which the length is 3...
分类:
其他好文 时间:
2015-08-17 06:33:30
阅读次数:
232
leetcode -Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000,...
分类:
其他好文 时间:
2015-08-17 00:58:54
阅读次数:
112
Palindrome Partitioning
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 = "a...
分类:
其他好文 时间:
2015-08-16 18:22:35
阅读次数:
102
首先,StringBuffer的toString方法和String的subString方法都是在新生成了一个新的String。 最近做的一个功能,多线程的从SQLite数据库中读取数据。将数据拼成在MySQL中可以批量执行的SQL语句,再多线程地插入到MySQL中。
分类:
其他好文 时间:
2015-08-16 12:09:50
阅读次数:
123