std::string::find_last_not_of
std::string::find_last_not_of
| string (1) |
size_t find_last_not_of (const string& str, size_t pos = npos) const; |
|---|---|
| c-string (2) |
size_t find_last_not_of (const char* s, size_t pos = npos) const; |
| buffer (3) |
size_t find_last_not_of (const char* s, size_t pos, size_t n) const; |
| character (4) |
size_t find_last_not_of (char c, size_t pos = npos) const; |
Searches the string for the last character that does not match any of the characters specified in its arguments.
When pos is specified, the search only includes characters at or before position pos, ignoring any possible occurrences after pos.
Parameters
- str
- Another string with the set of characters to be used in the search.
- pos
- Position of the last character in the string to be considered in the search.
Any value greater than, or equal to, the string length (including string::npos) means that the entire string is searched.
Note: The first character is denoted by a value of 0 (not 1). - s
- Pointer to an array of characters.
If argument n is specified (3), the first n characters in the array are used in the search.
Otherwise (2), a null-terminated sequence is expected: the length
of the sequence with the characters used in the search is determined by
the first occurrence of a null character. - n
- Number of character values to search for.
- c
- Individual character to be searched for.
size_t is an unsigned integral type (the same as member typestring::size_type).
Return Value
The position of the first character that does not match.
If no such characters are found, the function returns string::npos.
size_t is an unsigned integral type (the same as member typestring::size_type).
Example
|
|
[Please, erase trailing white-spaces] |
Complexity
Unspecified, but generally up to linear in the string length (or pos) times the number of characters to match (worst case).
Iterator validity
No changes.
Data races
The object is accessed.
Exception safety
If s does not point to an array long enough, it causes undefined behavior.
Otherwise, the function never throws exceptions (no-throw guarantee).
See also
- string::find
- Find content in string (public member function
)
- string::find_last_of
- Find character in string from the end (public member function
)
- string::find_first_not_of
- Find absence of character in string (public member function
)
- string::replace
- Replace portion of string (public member function
)
- string::substr
- Generate substring (public member function
) - http://www.cplusplus.com/reference/string/string/find_last_not_of/
std::string::find_last_not_of的更多相关文章
- c++ std::string 用法
std::string用法总结 在平常工作中经常用到了string类,本人记忆了不好用到了的时候经常要去查询.在网上摘抄一下总结一下,为以后的查询方便: string类的构造函数: string(co ...
- std::string 用法总结
标准C++中的string类的用法总结 相信使用过MFC编程的朋友对CString这个类的印象应该非常深刻吧?的确,MFC中的CString类使用起来真的非常的方便好用.但是如果离开了MFC框架,还有 ...
- std::string find 的返回值
std::string 的方法 find,返回值类型是std::string::size_type, 对应的是查找对象在字符串中的位置(从0开始), 如果未查找到,该返回值是一个很大的数据(4294 ...
- std::string 用法
string类的构造函数:string(const char *s); //用c字符串s初始化string(int n,char c); //用n个字符c初始化 string类的字符操作:const ...
- std::string类详解
之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必 担心内存是否足够.字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至 ...
- QString 和std::string互转
std::string cstr; QString qstring; //****从std::string 到QString qstring = QString(QString::fromLocal8 ...
- std::string的split函数
刚刚要找个按空格分离std::string的函数, 结果发现了stackoverflow上的这个问题. 也没仔细看, 直接拿来一试, 靠, 不对啊, 怎么分离后多出个空字符串, 也就是 "a ...
- could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
VS2008, 写一个简单的demo的时候出现了这个: 1>------ Build started: Project: GetExportTable, Configuration: Relea ...
- 源码阅读笔记 - 3 std::string 与 Short String Optimization
众所周知,大部分情况下,操作一个自动(栈)变量的速度是比操作一个堆上的值的速度快的.然而,栈数组的大小是在编译时确定的(不要说 C99 的VLA,那货的 sizeof 是运行时计算的),但是堆数组的大 ...
随机推荐
- 剪邮票--蓝桥杯--dfs--思路超清晰
剪邮票 如[图1.jpg], 有12张连在一起的12生肖的邮票. 现在你要从中剪下5张来,要求必须是连着的. (仅仅连接一个角不算相连) 比如,[图2.jpg],[图3.jpg]中,粉红色所示部分就是 ...
- 解决nginx文件服务器访问403
2018-10-24 nginx配置文件目录服务器 修改/etc/nginx/conf.d/default.conf或者在/etc/nginx/conf.d/目录下添加一配置文件,如下 server ...
- VUE--mixins的一些理解。
概念:混入 (mixins) 是一种分发 Vue 组件中可复用功能的非常灵活的方式.混入对象可以包含任意组件选项.当组件使用混入对象时,所有混入对象的选项将被混入该组件本身的选项. 用法: 1.创建混 ...
- 转帖 css的块元素、内联元素、内联块元素、display属性、浮动、定位
块元素 块元素,也可以称为行元素,布局中常用的标签如:div.p.ul.li.h1~h6.dl.dt.dd等等都是块元素,它在布局中的行为:1.支持全部的样式.2.如果没有设置宽度,默认的宽度为父级宽 ...
- 线程同步(windows平台):事件
一:介绍 事件Event实际上是个内核对象,事件分两种状态:激发状态和未激发状态.分两种类型:手动处置事件和自动处置事件.手动处置事件被设置为激发状态后,会唤醒所有等待的线程,一直保持为激发状态,直到 ...
- mysql 查询及 删除表中重复数据
CREATE TABLE `test` ( `id` INT(20) NOT NULL AUTO_INCREMENT, `name` VARCHAR(20) NULL DEFAULT NULL, `a ...
- Linux kernel workqueue机制分析
Linux kernel workqueue机制分析 在内核编程中,workqueue机制是最常用的异步处理方式.本文主要基于linux kernel 3.10.108的workqueue文档分析其基 ...
- Spring3.2下使用JavaMailSenderImpl类发送邮件
1.JavaMailSenderImpl类 Spring的邮件发送的核心是MailSender接口,在Spring3.0中提供了一个实现类JavaMailSenderImpl,这个类是发送邮件的核心类 ...
- log4net写入DB2备忘 via OLEDB & ODBC
在项目中遇到需要记录操作日志的需求,由于是一个外挂系统,因此不用考虑到公司框架的限制,直接二层架构直连数据库,考虑使用log4net连接DB2.请宽恕我这个非软工科班出身的IT小白,以前一直在知道有个 ...
- java字节码速查笔记
java字节码速查笔记 发表于 2018-01-27 | 阅读次数: 0 | 字数统计: | 阅读时长 ≍ 执行原理 java文件到通过编译器编译成java字节码文件(也就是.class文件) ...