CString::Compareint Compare( LPCTSTR lpsz ) const;返回值字符串一样 返回0小于lpsz返回-1大于lpsz返回1区分大小字符 CString s1( "abc" );CString s2( "abd" );ASSERT( s1.Compare( .....
分类:
其他好文 时间:
2015-03-20 16:10:08
阅读次数:
204
https://leetcode.com/problems/compare-version-numbers/Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1 Integer.p...
分类:
其他好文 时间:
2015-03-20 14:20:07
阅读次数:
101
Corner case: when all the elements are 0. It should return "0", not "00000000".It use string to compare all the numbers. 1 class Solution { 2 public: ...
分类:
其他好文 时间:
2015-03-20 06:58:14
阅读次数:
109
Two notes:1. I dont know whether C++ has a good split function for STL as the JAVA. Need to figure it out.2. At the beginning, I tried to set tmp1 = t...
分类:
其他好文 时间:
2015-03-19 06:17:36
阅读次数:
130
What is SolrCloud?(And how does it compare to master-slave?)SolrCloud is a set of new features and functionality added in Solr 4.0 to enable a new way...
分类:
其他好文 时间:
2015-03-18 17:21:52
阅读次数:
365
Java的集合类分为两个类型,Collection和Map,Collection又分为Set和List。
1. 集合类中元素是否相同
HashSet使用equals和HashCode两个函数共同决定
TreeSet使用comparable接口中的compareTo,或者comparator中的compare函数
ArrayList使用equals函数
HashMap中的key和Has...
分类:
编程语言 时间:
2015-03-18 16:02:54
阅读次数:
259
#include#includeusing namespace std;//T为非空串,若主串S中的第pos个字符串之后存在与T相等的子串//则返回第一个这样子串的位置,否则返回0int string_compare(string A,int i,string B);int Index(string...
分类:
其他好文 时间:
2015-03-17 17:48:30
阅读次数:
119
两种方式。
1.继承Comparator接口。
实现compare方法。
public int compare(Person o1, Person o2) {
return o2.getAge().compareTo(o1.getAge());
}
2.Collections.sort方法。(建议,方便)
List list = new ArrayList();
list....
分类:
编程语言 时间:
2015-03-16 16:25:29
阅读次数:
166
深入学习C语言,必须知道每个C语言库函数的实现原理与作用,否则在使用的时候很容易出错误,甚至还不知道错误在哪里。了解每个库函数的实现方法和作用,加上算法。比如字符串处理函数strcmp,比较两个字符串之间的大小,区分大小写。strcmp函数的实现(并不唯一):/*strcmpfunc..
分类:
编程语言 时间:
2015-03-16 11:14:00
阅读次数:
179
在今天做的LeetCode的题中有两道都出现了利用接口实现对象的排序,两题的相关链接:
1.利用comparable接口对对象排序
2.利用comparator接口实现排序
由于之前都没接触过这两个接口,一时不能明白它们的作用,所以在网上查找了很多资料,现在大致弄清楚一些,现在记录下来,有什么欠缺,欢迎大家及时指正
1.Comparable接口
在java API文档中描述此接口...
分类:
其他好文 时间:
2015-03-16 01:02:02
阅读次数:
289