我想使它所以每個代碼總是看起來是一樣的,不管你使用100位等格式文本(代碼),去掉空格和東西
因此,例如
Example: lwz r4,-0x0018(rtoc)
這代碼的外觀應該如何,下面是如何輸入代碼的例子。
lwz r4, -0x0018 (rtoc)
lwz r4,-0x0018(rtoc)
lwz r4,-0x0018 (rtoc)
還有其他的代碼,但我認爲一般規則是。
(無空格周圍「」和「周圍沒有空間‘(’和‘)’)。
由於這將打通線循環多次,該方法最好是相當快的。
我不反對使用不安全的代碼等等:)
感謝
編輯:!
代碼,也可以像: 「FMUL F0,F1,F2」,並同樣適用那裏。
我試過的是通過它看作一個指針(不安全)。 但是,雖然我可以替換字符,我不能刪除他們說。 我想我必須做沒有指針,但我仍然不知道如何找出循環的規則,即使我有點抓住它。 (ifs等格式)。
EDIT2:
這是當前亂碼我似乎讀懂了工作。
private string FormatCode(string text)
{
int length = text.Length;
char last = '.';
for (int i = 0; i < text.Length; i++)
{
char c = text[i];
if (c == ' ' && last == ',')
{
text = text.Remove(i, 1);
i--;
}
else if (c == ',' && last == ' ')
{
text = text.Remove(i-1, 1);
i--;
}
else if(c=='(' && last == ' ')
{
text = text.Remove(i - 1, 1);
i--;
}
else if(c == ' ' && last == ')')
{
text = text.Remove(i, 1);
i--;
}
else if (c == ' ' && last == ' ')
{
text = text.Remove(i, 1);
i--;
}
last = c;
}
return text;
}
你嘗試過什麼做的?顯示你的努力,並解釋他們爲什麼不爲你工作 – UnholySheep
@UnholySheep增加了一點:) – Zerowalker