国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
C++ Strings
Constructors
Syntax:
 string( size_type length, char ch );
 string( const char *str );
 string( input_iterator start, input_iterator end );
append
Syntax:
 basic_string &append( const basic_string &str );
 basic_string &append( const char *str );
 basic_string &append( const basic_string &str, size_type index, size_type len );
 basic_string &append( const char *str, size_type num );
 
size
Syntax:
 size_type size();
The size() function returns the number of characters currently in the string.
at
Syntax:
 reference at( size_type index );
The at() function returns a reference to the character at location index. If index is not within the string, then at() reports an out of range error by throwing an object of the out_of_range class. For example, this code:
    string text = "ABCDEF";
    char ch = text.at( 2 );
displays the character 'C'.
begin
Syntax:
 iterator begin();
The begin() function returns an iterator to the first element of the current string.
erase
Syntax:
 iterator erase( iterator pos );
 iterator erase( iterator start, iterator end );
 basic_string &erase( size_type index = 0, size_type num = npos );
 
The erase() function either:
·                         removes the character pointed to by pos, returning an iterator to the next character,
·                         removes the characters between start and end, returning an iterator to the character after the last character removed,
·                         or removes num characters from the current string, starting at index, and returns *this.
The parameters index and num have default values, which means that erase() can be called with just index to erase all characters after index or with no arguments to erase all characters. For example:
    string s("So, you like donuts, eh? Well, have all the donuts in the world!");
    cout << "The original string is '" << s << "'" << endl;
    s.erase( 50, 14 );
    cout << "Now the string is '" << s << "'" << endl;
    s.erase( 24 );
    cout << "Now the string is '" << s << "'" << endl;
    s.erase();
    cout << "Now the string is '" << s << "'" << endl;
will display
The original string is 'So, you like donuts, eh? Well, have all the donuts in the world!'
Now the string is 'So, you like donuts, eh? Well, have all the donuts'
Now the string is 'So, you like donuts, eh?'
Now the string is ''
find
Syntax:
 size_type find( const basic_string &str, size_type index );
 size_type find( const char *str, size_type index );
 size_type find( const char *str, size_type index, size_type length );
 size_type find( char ch, size_type index );
The function find() either:
returns the first occurrence of str within the current string, starting at index, string::npos if nothing is found, 
returns the first occurrence of str within the current string and within length characters, starting at index, string::npos if nothing is found, 
or returns the index of the first occurrence ch within the current string, starting at index, string::npos if nothing is found. 
For example, 
    string str1( "Alpha Beta Gamma Delta" );
    unsigned int loc = str1.find( "Omega", 0 );
    if( loc != string::npos )
      cout << "Found Omega at " << loc << endl;
    else
      cout << "Didn't find Omega" << endl;
insert
Syntax:
 iterator insert( iterator i, const char &ch );
 basic_string &insert( size_type index, const basic_string &str );
 basic_string &insert( size_type index, const char *str );
 basic_string &insert( size_type index, const char *str, size_type num );
 basic_string &insert( size_type index, size_type num, char ch );
 void insert( iterator i, size_type num, const char &ch );
 void insert( iterator i, iterator start, iterator end );
The very multi-purpose insert() function either:
inserts ch before the character denoted by i, 
inserts str into the current string, at location index, 
inserts a substring of str (starting at index2 and num characters long) into the current string, at location index1, 
inserts num characters of str into the current string, at location index, 
inserts num copies of ch into the current string, at location index, 
inserts num copies of ch into the current string, before the character denoted by i, 
or inserts the characters denoted by start and end into the current string, before the character specified by i. 
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
c++ substr()和assign()函數(shù)用法
轉(zhuǎn): std::string用法詳解
java中判斷字符串是否是一個整數(shù)(轉(zhuǎn)載)
char[] && string
char * ,char,string與NSString轉(zhuǎn)化(objec
C/C++字符串查找函數(shù) <轉(zhuǎn)>
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服