STL (d) of the string C ++ Standard Library (d) of the String

C ++ Standard Library (d) of the String

String

  • Common operations
bool empty() const size_type size() const size_type length() const size_type max_size() const size_type capacity() const void resever() void resever(size_type numbers) void shrink_to_fit()
  • Produce C-String and array of characters
const char* c_str() const
const char* data() const
  • Add character
String& operator+=(const String& str) String& append(const String& str) String& operator+=(const char* cstr) String& append(const char* cstr) String& append(size_type num,char c) String& operator+=(char c) String& push_back(char c)
  • Placement of characters
String& insert(size_type idx,const String& str)
String& insert(size_type idx,const char* str)
  • To delete a character
void clear()
String& erase()
String& erase(size_type idx)
void pop_back()
  • Replace characters
String& replace(size_type idx,size_type len,const String& str) String& replace(Iterator beg,Iterator end,const String& str) String& replace(size_type idx,size_type len,const char* str)
  • Seek
size_type find(char c) const size_type find(char c,size_type idx) const size_type rfind(char c) const size_type rfind(char c,size_type idx) const //从idx位置开始查找 size_type find(const String& str) const size_type find(const String& str,size_type idx) const size_type rfind(const String& str) size_type rfind(const String& str,size_type idx) const size_type find(const char* str) const size_type find(const char* str,size_type idx) const size_type rfind(const char* str) size_type rfind(const char* str,size_type idx) const 查找第一个符合条件的字符 size_type find_first_of(const String& str) const size_type find_first_of(const String& str,size_type idx) const size_type find_first_not_of(const String& str) const size_type find_first_not_of(const String& str,size_type idx) const size_type find_first_of(const char* cstr) const size_type find_first_of(const char* cstr,size_type idx) const size_type find_first_not_of(const char* cstr) const size_type find_first_not_of(const char* cstr,size_type idx) const size_rtpe find_first_of(char c) const size_tyoe find_first_of(char c,size_type idx) const size_type find_first_not_of(char c) const size_type find_first_not_of(char c,size_type idx) const 查找最后一个符合条件的字符 size_type find_last_of(const String& str) const size_type find_last_of(const String& str,size_type idx) const size_type find_last_not_of(const String& str) const size_type find_last_not_of(const String& str,size_type idx) const size_type find_last_of(const char* cstr) const size_type find_last_of(const char* cstr,size_type idx) const size_type find_last_not_of(const char* cstr) const size_type find_last_not_of(const char* cstr,size_type idx) const size_rtpe find_last_of(char c) const size_tyoe find_last_of(char c,size_type idx) const size_type find_last_not_of(char c) const size_type find_last_not_of(char c,size_type idx) const
  • Cut the string
String substr() const
String substr(size_type idx) const String substr(size_type idx,size_type len) const
  • Numeric conversion
int stoi(const String& str)
int stol(const String& str) int stoul(const String& str) int stoll(const String& str) int stoull(const String& str) int stof(const String& str) int stod(const String& str) int stold(const String& str) String to_string(Type val)

String

  • Common operations
bool empty() const size_type size() const size_type length() const size_type max_size() const size_type capacity() const void resever() void resever(size_type numbers) void shrink_to_fit()
  • Produce C-String and array of characters
const char* c_str() const
const char* data() const
  • Add character
String& operator+=(const String& str) String& append(const String& str) String& operator+=(const char* cstr) String& append(const char* cstr) String& append(size_type num,char c) String& operator+=(char c) String& push_back(char c)
  • Placement of characters
String& insert(size_type idx,const String& str)
String& insert(size_type idx,const char* str)
  • To delete a character
void clear()
String& erase()
String& erase(size_type idx)
void pop_back()
  • Replace characters
String& replace(size_type idx,size_type len,const String& str) String& replace(Iterator beg,Iterator end,const String& str) String& replace(size_type idx,size_type len,const char* str)
  • Seek
size_type find(char c) const size_type find(char c,size_type idx) const size_type rfind(char c) const size_type rfind(char c,size_type idx) const //从idx位置开始查找 size_type find(const String& str) const size_type find(const String& str,size_type idx) const size_type rfind(const String& str) size_type rfind(const String& str,size_type idx) const size_type find(const char* str) const size_type find(const char* str,size_type idx) const size_type rfind(const char* str) size_type rfind(const char* str,size_type idx) const 查找第一个符合条件的字符 size_type find_first_of(const String& str) const size_type find_first_of(const String& str,size_type idx) const size_type find_first_not_of(const String& str) const size_type find_first_not_of(const String& str,size_type idx) const size_type find_first_of(const char* cstr) const size_type find_first_of(const char* cstr,size_type idx) const size_type find_first_not_of(const char* cstr) const size_type find_first_not_of(const char* cstr,size_type idx) const size_rtpe find_first_of(char c) const size_tyoe find_first_of(char c,size_type idx) const size_type find_first_not_of(char c) const size_type find_first_not_of(char c,size_type idx) const 查找最后一个符合条件的字符 size_type find_last_of(const String& str) const size_type find_last_of(const String& str,size_type idx) const size_type find_last_not_of(const String& str) const size_type find_last_not_of(const String& str,size_type idx) const size_type find_last_of(const char* cstr) const size_type find_last_of(const char* cstr,size_type idx) const size_type find_last_not_of(const char* cstr) const size_type find_last_not_of(const char* cstr,size_type idx) const size_rtpe find_last_of(char c) const size_tyoe find_last_of(char c,size_type idx) const size_type find_last_not_of(char c) const size_type find_last_not_of(char c,size_type idx) const
  • Cut the string
String substr() const
String substr(size_type idx) const String substr(size_type idx,size_type len) const
  • Numeric conversion
int stoi(const String& str)
int stol(const String& str) int stoul(const String& str) int stoll(const String& str) int stoull(const String& str) int stof(const String& str) int stod(const String& str) int stold(const String& str) String to_string(Type val)

Guess you like

Origin www.cnblogs.com/xcb-1024day/p/11332472.html