刪除網頁的標籤 |
答題得分者是:harpist
|
astro0803
一般會員 發表:18 回覆:30 積分:9 註冊:2007-05-28 發送簡訊給我 |
如題,我將一個網頁抓回來之前,要將其標籤刪除,可是一直會有問題,但我就是不知道問題所在,之後我就自己新增類似網頁標籤的字串來測試,便發現是會多刪一個字之類的,但真正的問題我目前還沒找出來,程式碼如下: <textarea cols="60" rows="10" class="cpp" name="code"> void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString word="000000
|
harpist
資深會員 發表:3 回覆:251 積分:430 註冊:2002-10-03 發送簡訊給我 |
<textarea class="cpp" rows="10" cols="60" name="code">AnsiString::Delete
Removes a specified number of characters from the string.
AnsiString& __fastcall Delete(int index, int count);
Description
Delete modifies the AnsiString to remove count characters from the string beginning with the character at index, where 1 is the index of the first character. It returns the resulting modified string (*this).
If index is larger than the length of the AnsiString or less than 1, no characters are deleted.
If count specifies more characters than remain starting at the index, Delete removes the rest of the string. If count is less than 0, no characters are deleted.
</textarea>
AnsiString::Delete 不是如你這樣用的喔 <textarea class="cpp" rows="10" cols="60" name="code">void __fastcall TForm1::Button1Click(TObject *Sender) { AnsiString word="000000
------
~§~迷時師渡,悟了自渡~§~
編輯記錄
harpist 重新編輯於 2007-06-05 23:03:05, 註解 修改變數名稱‧
|
astro0803
一般會員 發表:18 回覆:30 積分:9 註冊:2007-05-28 發送簡訊給我 |
奇怪,那我一開始是設這樣有錯嗎?不是跟你的差不多= ="
到底是那有問題呢?可以跟我解釋一下嗎? <textarea cols="60" rows="10" class="cpp" name="code">
while(word.AnsiPos("<")!=0)
{
pos_start=word.AnsiPos("<");
pos_end=word.AnsiPos(">");
word.Delete(pos_start,pos_end);
Memo1->Lines->Add(word);
}
</textarea>
|
harpist
資深會員 發表:3 回覆:251 積分:430 註冊:2002-10-03 發送簡訊給我 |
|
astro0803
一般會員 發表:18 回覆:30 積分:9 註冊:2007-05-28 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |