您的位置:首页 > 编程语言 > C语言/C++

C++字符串几个操作

2016-04-07 14:22 357 查看


Convert from strings

stoi
Convert string to integer (function template )

stol
Convert string to long int (function template )

stoul
Convert string to unsigned integer (function template )

stoll
Convert string to long long (function template )

stoull
Convert string to unsigned long long (function template )

stof
Convert string to float (function template )

stod
Convert string to double (function template )

stold Convert
string to long double (function template )




Convert to strings

to_string
Convert numerical value to string (function )

to_wstring
Convert numerical value to wide string (function )

Modifiers:

operator+=
Append to string (public member function )

append
Append to string (public member function )

push_back
Append character to string (public member function )

assign
Assign content to string (public member function )

insert
Insert into string (public member function )

erase
Erase characters from string (public member function )

replace
Replace portion of string (public member function )

swap
Swap string values (public member function )

pop_back
Delete last character (public member function )

String operations:

c_str
Get C string equivalent (public member function )

data
Get string data (public member function )

get_allocator
Get allocator (public member function )

copy
Copy sequence of characters from string (public member function )

find
Find content in string (public member function )

rfind
Find last occurrence of content in string (public member function )

find_first_of
Find character in string (public member function )

find_last_of
Find character in string from the end (public member function )

find_first_not_of
Find absence of character in string (public member function )

find_last_not_of
Find non-matching character in string from the end (public member function )

substr
Generate substring (public member function )

compare
Compare strings (public member function )

substr是取子串返回子串结果;

find是从指定下表开始,查找匹配子串,并返回匹配的子串下标

replace,是把字符串的从下标(i,j)替换为给出的子串
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: