Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
文字樣式
變更外觀
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
11 年前
差異永不過期
清除
匯出
分享
解釋
4 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
39 行
全部複製
6 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
41 行
全部複製
static string insert(string text, string wort, int pos)
static string insert(string text, string wort, int pos)
{
{
if (pos == 0)
if (pos == 0)
{
{
return wort + " " + text;
return wort + " " + text;
}
}
string newtext = "";
string newtext = "";
int spacecount = 0;
int spacecount = 0;
bool inserted = false;
bool inserted = false;
for (int i = 0; i < text.Length; i++)
for (int i = 0; i < text.Length; i++)
{
{
newtext += text[i];
newtext += text[i];
if (inserted == false)
if (inserted == false)
{
{
複製
已複製
複製
已複製
if (pos > spacecount)
{
return wort + " " + text;
}
if (text[i] == ' ')
if (text[i] == ' ')
{
{
spacecount++;
spacecount++;
}
}
if (spacecount == pos)
if (spacecount == pos)
{
{
newtext += wort + " ";
newtext += wort + " ";
inserted = true;
inserted = true;
}
}
}
}
}
}
複製
已複製
複製
已複製
if (pos > spacecount)
{
return text + " " + wort;
}
return newtext;
return newtext;
}
}
已保存差異
原始文本
開啟檔案
static string insert(string text, string wort, int pos) { if (pos == 0) { return wort + " " + text; } string newtext = ""; int spacecount = 0; bool inserted = false; for (int i = 0; i < text.Length; i++) { newtext += text[i]; if (inserted == false) { if (pos > spacecount) { return wort + " " + text; } if (text[i] == ' ') { spacecount++; } if (spacecount == pos) { newtext += wort + " "; inserted = true; } } } return newtext; }
更改後文本
開啟檔案
static string insert(string text, string wort, int pos) { if (pos == 0) { return wort + " " + text; } string newtext = ""; int spacecount = 0; bool inserted = false; for (int i = 0; i < text.Length; i++) { newtext += text[i]; if (inserted == false) { if (text[i] == ' ') { spacecount++; } if (spacecount == pos) { newtext += wort + " "; inserted = true; } } } if (pos > spacecount) { return text + " " + wort; } return newtext; }
尋找差異