Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/MojuUtils.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.12 by h677, Sun Jul 31 10:27:25 2005 UTC revision 1.13 by h677, Mon Aug 22 14:23:16 2005 UTC
# Line 14  unit MojuUtils; Line 14  unit MojuUtils;
14  interface  interface
15    
16  uses  uses
17          Windows, Classes, SysUtils;          Windows, Classes, SysUtils, GikoSystem;
18    
19          function StrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;          function StrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;
20          function AnsiStrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;          function AnsiStrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;
# Line 31  uses Line 31  uses
31          function IsNoValidID( inID :String): Boolean;          function IsNoValidID( inID :String): Boolean;
32          //<font>タグを全て削除する          //<font>タグを全て削除する
33          function        DeleteFontTag( inSource : string) : string;          function        DeleteFontTag( inSource : string) : string;
34            function DivideStrLine(Line: string): TResRec;
35            function RemoveToken(var s: string;const delimiter: string): string;
36    
37  implementation  implementation
38  // ポインター&アセンブラによる高速ポス  // ポインター&アセンブラによる高速ポス
# Line 43  asm Line 45  asm
45                  MOV    ESI,ECX        { Point ESI to substr                  }                  MOV    ESI,ECX        { Point ESI to substr                  }
46                  MOV    EDI,EAX        { Point EDI to s                        }                  MOV    EDI,EAX        { Point EDI to s                        }
47    
48          MOV    ECX,EDX        { ECX = search length                  }                  MOV    ECX,EDX        { ECX = search length                  }
49          SUB    ECX,EAX          SUB    ECX,EAX
50    
51          MOV    EDX,SubstrEnd          MOV    EDX,SubstrEnd
# Line 335  begin Line 337  begin
337  end;  end;
338  // *************************************************************************  // *************************************************************************
339    
340    (*************************************************************************
341     * datファイルの一ラインを分解
342     *************************************************************************)
343    function DivideStrLine(Line: string): TResRec;
344    var
345            Delim: string;
346    begin
347            if AnsiPos('<>', Line) = 0 then begin
348                    //Delim := ',';
349                    //Result.FType := glt2chOld;
350                    Line := CustomStringReplace(Line, '<>', '&lt;&gt;');
351                    Line := CustomStringReplace(Line, ',', '<>');
352                    Line := CustomStringReplace(Line, '@`', ',');
353            end;
354            Delim := '<>';
355            Result.FType := glt2chNew;
356            //Trimしてはいけない気がする byもじゅ
357            Result.FName := RemoveToken(Line, Delim);
358            Result.FMailTo := RemoveToken(Line, Delim);
359            Result.FDateTime := RemoveToken(Line, Delim);
360            Result.FBody := RemoveToken(Line, Delim);
361            //2ちゃんねるとかだと、本文の先頭に1つ半角空白が入っているので削除する
362            //他の掲示板で、レス自体の空白かもしれないけどそれは諦める
363            Result.FBody := TrimLeft(Result.FBody);
364            //空だと問題が起きるから、空白を設定する
365            if Result.FBody = '' then
366                    Result.FBody := '&nbsp;';
367    
368            Result.FTitle := RemoveToken(Line, Delim);
369    
370    end;
371    
372    (*************************************************************************
373     *
374     *どこかのサイトからのパクリ
375     *************************************************************************)
376    function RemoveToken(var s: string;const delimiter: string): string;
377    var
378            p: Integer;
379    begin
380            p := AnsiPos(delimiter, s);
381            if p = 0 then
382                    Result := s
383            else
384                    Result := Copy(s, 1, p - 1);
385            Delete(s, 1, Length(Result) + Length(delimiter));
386    end;
387    
388    
389  end.  end.

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26