A题笔记(14)

Reverse Words in a String : http://oj.leetcode.com/problems/reverse-words-in-a-string/

代码 : https://code.csdn.net/snippets/252509

Evaluate Reverse Polish Notation : http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/

代码 : https://code.csdn.net/snippets/252512

区分:“x” 和 ‘x’ 

string 中 find 类的函数都有两个版本

        string::size_type iFind, iFind2;
        iFind=s.find_first_not_of(" ");    
        iFind=s.find_first_not_of(" ", iFindend);

一个是从头开始查找,另一个从给定下标出开始查找,而且返回的都是下标而并非迭代器

find 和 find_first_of 、find_first_not_of 等不同

        s.find(args);
        s.find_first_of(args);
        s.find_first_not_of(args);

find 是 找到第一个 args(整体) 出现的地方,find_first_of 是找到第一个 args 中任意一元素出现的地方, find_first_not_of 找出不属于 args 中的字符

substr 也有几个版本,pow 和 n 都是下标类型,不是迭代器!

        s.substr(pow, n);
        s.substr(pow);
        s.substr();

分别是返回 string 中 pow 开始的n个字符的字串, pow 开始到结束的字串,或是 s 的副本

原文地址:https://www.cnblogs.com/LeoGodfrey/p/3616817.html