这道题在LeetCode OJ上难道属于Easy.可是通过率却比較低,究其原因是须要考虑的情况比較低,非常少有人一遍过吧. [题目] 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 what are the pos…
String字符串相加的问题 前几天同事跟我说我之前写的代码中在操作字符串时候,使用字符串相加的方式而不是使用StringBuffer或者StringBuilder导致内存开销很大.这个问题一直在困扰我,因为在<Think in java>一书中,作者说使用"+"拼接字符串并不比StringBuffer或者StringBuilder效率低下,因为"+"是java唯一一个系统级的针对字符串的重载过的操作符. 大家都知道String是一个final修饰的类.…