请教如何使用breakapart这个函数?如何调用? |
答題得分者是:Mickey
|
jtp
初階會員 發表:39 回覆:81 積分:29 註冊:2003-04-20 發送簡訊給我 |
|
Mickey
版主 發表:77 回覆:1882 積分:1390 註冊:2002-12-11 發送簡訊給我 |
沒必要另外開一個問題吧.
節錄一段 Indy.hlp 內文 :
Separates a string into a list of tokens using a specified delimiter. function BreakApart(BaseString: string; BreakString: string; StringList: TStrings): TStrings; Parameters BaseString: string Values to be broken into tokens. BreakString: string Delimiter between tokens in the origin data. StringList: TStrings Container for tokens found in the origin data. Returns TStrings - Container for tokens found in the string value. Description BreakApart is a TStrings function that separates the values in BaseString into tokens using the delimiter specified in BreakString. Tokens are extracted from BaseString starting at the left-most position, and continuing until no more data remains to be processed in BaseString. If BreakString does not occur in BaseString, the entire value in BaseString is added to StringList as a single token. The return value for the function is the argument specified in StringList after tokens have been added to the container. 節錄自 IdGlobal.pas : function BreakApart(BaseString, BreakString: string; StringList: TStrings): TStrings; var EndOfCurrentString: integer; begin repeat EndOfCurrentString := Pos(BreakString, BaseString); if (EndOfCurrentString = 0) then begin StringList.add(BaseString); end else StringList.add(Copy(BaseString, 1, EndOfCurrentString - 1)); delete(BaseString, 1, EndOfCurrentString + Length(BreakString) - 1); //Copy(BaseString, EndOfCurrentString + length(BreakString), length(BaseString) - EndOfCurrentString); until EndOfCurrentString = 0; result := StringList; end; |
jtp
初階會員 發表:39 回覆:81 積分:29 註冊:2003-04-20 發送簡訊給我 |
|
Mickey
版主 發表:77 回覆:1882 積分:1390 註冊:2002-12-11 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |