这里用到String类库里的indexOf()函数和subString()函数。 直接贴源码: ?static?int?countStr(String?str,String?subStr){
??
??int?count?=?0;
??if(str.indexOf(subStr)==-1)
???return?0;
...
分类:
其他好文 时间:
2015-09-15 11:15:51
阅读次数:
124
Longest Repeated SubstringTime Limit: 5000msMemory Limit: 32768KBThis problem will be judged onZJU. Original ID:319964-bit integer IO format:%lld Java...
分类:
其他好文 时间:
2015-09-14 22:42:54
阅读次数:
288
需求:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest...
分类:
其他好文 时间:
2015-09-14 22:27:06
阅读次数:
156
mysql字符串分割类似split SELECT?SUBSTRING_INDEX(REVERSE(SUBSTRING_INDEX("aa,bb,cc,dd",?",",?1)),?",",?1);????#aa??
SELECT?SUBSTRING_INDEX(REVERSE(SUBSTRING_INDEX("aa,bb,cc,dd",?",",?2...
分类:
数据库 时间:
2015-09-14 18:12:26
阅读次数:
156
题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest...
分类:
其他好文 时间:
2015-09-14 16:46:54
阅读次数:
101
1. 字符串str.charAt(index)——找不到,返回空字符串str.indexOf(找东西)——找到了返回一个下标,没找到返回-1str.lastIndexOf()——从后面往前找 同上str.substring(beginIndex[, endIndex])——截取字符串,不包含最后一....
分类:
编程语言 时间:
2015-09-14 16:46:33
阅读次数:
202
Part 22 Built in string functions in sql server 2008Part 23 LEFT, RIGHT, CHARINDEX and SUBSTRING functions in sql serverPart 24 Replicate, Space, Pati...
分类:
其他好文 时间:
2015-09-14 01:56:59
阅读次数:
165
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-09-14 01:55:44
阅读次数:
139
1、trim性能特征去掉字符串首尾空格,防止不必要的空格导致错误。public class TrimTest{ public static void main(String[] args) { String str1=" cjc"; String str2=" c jc "; System.o...
分类:
编程语言 时间:
2015-09-13 18:28:22
阅读次数:
203
String substring(start,end): slice(start,end); 这两个函数的第二个参数都是置顶区间的末端设置,而不是该区间的长度, substring对于end为负数的处理都将视为0, 而slice方法则会将它与字符串的长度相加,如: ...
分类:
编程语言 时间:
2015-09-13 17:10:03
阅读次数:
182