目录

back

描述 (Description)

它返回对字符串的最后一个字符的引用。

声明 (Declaration)

以下是std :: string :: back的声明。

char& back();

C++11

const char& back() const;

参数 (Parameters)

没有

返回值 (Return Value)

它返回对字符串的最后一个字符的引用。

异常 (Exceptions)

如果抛出异常,则字符串中没有变化。

例子 (Example)

在下面的示例中为std :: string :: back。

#include <iostream>
#include <string>
int main () {
   std::string str ("sairamkrishna mammahe.");
   str.back() = '!';
   std::cout << str << '\n';
   return 0;
}
sairamkrishna mammahe!
↑回到顶部↑
WIKI教程 @2018