<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80%2F02-%E5%AD%97%E7%AC%A6%E4%B8%B2</id>
	<title>03-进阶基础/02-字符串 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80%2F02-%E5%AD%97%E7%AC%A6%E4%B8%B2"/>
	<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;action=history"/>
	<updated>2026-05-21T00:47:14Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=319&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=319&amp;oldid=prev"/>
		<updated>2026-05-20T18:12:09Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 18:12的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-318:rev-319 --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=318&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=318&amp;oldid=prev"/>
		<updated>2026-05-20T16:50:33Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 16:50的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-219:rev-318 --&gt;
&lt;/table&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=219&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=219&amp;oldid=prev"/>
		<updated>2026-05-20T16:25:16Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 16:25的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-218:rev-219 --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=218&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=03-%E8%BF%9B%E9%98%B6%E5%9F%BA%E7%A1%80/02-%E5%AD%97%E7%AC%A6%E4%B8%B2&amp;diff=218&amp;oldid=prev"/>
		<updated>2026-05-20T16:22:29Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; 类型 ==&lt;br /&gt;
&lt;br /&gt;
C++ 提供了 &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; 类型来处理字符串，使用前需要 &amp;lt;code&amp;gt;#include &amp;lt;string&amp;gt;&amp;lt;/code&amp;gt;（万能头文件已包含）。&lt;br /&gt;
&lt;br /&gt;
=== 定义与初始化 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s;                // 空字符串&lt;br /&gt;
string s = &amp;quot;hello&amp;quot;;      // 用字符串字面量初始化&lt;br /&gt;
string s(5, &amp;#039;a&amp;#039;);        // &amp;quot;aaaaa&amp;quot;，5 个 &amp;#039;a&amp;#039;&lt;br /&gt;
string s = t;            // 用另一个 string 初始化&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 基本操作 ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! 操作 !! 说明&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s.length()&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;s.size()&amp;lt;/code&amp;gt;&lt;br /&gt;
| 获取字符串长度&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s[i]&amp;lt;/code&amp;gt;&lt;br /&gt;
| 访问第 &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; 个字符（&amp;lt;math&amp;gt;0&amp;lt;/math&amp;gt; 起始）&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s += t&amp;lt;/code&amp;gt;&lt;br /&gt;
| 在末尾拼接字符串 &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s == t&amp;lt;/code&amp;gt;&lt;br /&gt;
| 判断两个字符串是否相等&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s &amp;lt; t&amp;lt;/code&amp;gt;&lt;br /&gt;
| 按字典序比较大小&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s.clear()&amp;lt;/code&amp;gt;&lt;br /&gt;
| 清空字符串&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s.empty()&amp;lt;/code&amp;gt;&lt;br /&gt;
| 判断字符串是否为空&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== 遍历字符串 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// 下标遍历&lt;br /&gt;
for (int i = 0; i &amp;lt; s.length(); i++)&lt;br /&gt;
    cout &amp;lt;&amp;lt; s[i];&lt;br /&gt;
&lt;br /&gt;
// 范围 for&lt;br /&gt;
for (char c : s)&lt;br /&gt;
    cout &amp;lt;&amp;lt; c;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;substr&amp;lt;/code&amp;gt; 取子串 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s = &amp;quot;abcdefg&amp;quot;;&lt;br /&gt;
string t = s.substr(2, 3); // &amp;quot;cde&amp;quot;，从下标 2 开始取 3 个字符&lt;br /&gt;
string u = s.substr(3);     // &amp;quot;defg&amp;quot;，从下标 3 取到末尾&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;find&amp;lt;/code&amp;gt; 查找子串 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s = &amp;quot;hello world&amp;quot;;&lt;br /&gt;
int pos = s.find(&amp;quot;world&amp;quot;);  // 返回 6&lt;br /&gt;
if (pos == string::npos)&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;未找到&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 字符串与数字的转换 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s = &amp;quot;123&amp;quot;;&lt;br /&gt;
int x = stoi(s);          // 字符串转 int&lt;br /&gt;
long long y = stoll(s);   // 字符串转 long long&lt;br /&gt;
double d = stod(s);       // 字符串转 double&lt;br /&gt;
&lt;br /&gt;
string t = to_string(123); // 数字转字符串&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 读入空格分隔的字符串 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s;&lt;br /&gt;
cin &amp;gt;&amp;gt; s; // 读入一个单词（遇到空格/换行停止）&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 读入一整行 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string s;&lt;br /&gt;
getline(cin, s); // 读入一整行（包括空格）&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 常用字符判断函数 ===&lt;br /&gt;
&lt;br /&gt;
需要 &amp;lt;code&amp;gt;#include &amp;lt;cctype&amp;gt;&amp;lt;/code&amp;gt;（万能头已包含）：&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! 函数 !! 说明&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isdigit(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 是否是数字 &amp;lt;code&amp;gt;&amp;#039;0&amp;#039;~&amp;#039;9&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isalpha(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 是否是字母&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;islower(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 是否是小写字母&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;isupper(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 是否是大写字母&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;tolower(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 转换为小写&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;toupper(c)&amp;lt;/code&amp;gt;&lt;br /&gt;
| 转换为大写&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:进阶基础]]&lt;br /&gt;
[[Category:三三文档]]&lt;/div&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
</feed>