線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:996
推到 Plurk!
推到 Facebook!

请教如何使用breakapart这个函数?如何调用?

答題得分者是:Mickey
jtp
初階會員


發表:39
回覆:81
積分:29
註冊:2003-04-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-30 10:09:16 IP:218.18.xxx.xxx 未訂閱
如题
Mickey
版主


發表:77
回覆:1882
積分:1390
註冊:2002-12-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-30 11:32:26 IP:218.163.xxx.xxx 未訂閱
沒必要另外開一個問題吧. 節錄一段 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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-30 11:41:19 IP:218.18.xxx.xxx 未訂閱
我用的是delphi6.0,为什么我的delphi里面没有idglobal这个文档的,真的怪,所以breakapart这个函数也用不了
Mickey
版主


發表:77
回覆:1882
積分:1390
註冊:2002-12-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-30 11:48:41 IP:218.163.xxx.xxx 未訂閱
可能是 Indy 版本差異.    你可以直接將綠色部分 Source Code, 貼入unit使用, 這樣就不須 uses IdGlobal < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=9196579&CC=205681">
系統時間:2024-07-01 23:36:03
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!