interface
uses
- Windows, Classes, SysUtils, GikoSystem;
+ Windows, Classes, SysUtils;
function StrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;
function AnsiStrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd: PChar): PChar;
- function ReplaceString(const S: String; const OldPattern: String; const NewPattern: string): string;
- function IgnoCaseReplaceString(const S: String; const OldPattern:String; const NewPattern: string): string;
+ function ReplaceString(const S: String; const OldPattern: String; const NewPattern: string): String;
+ function IgnoCaseReplaceString(const S: String; const OldPattern:String; const NewPattern: string): String;
function CustomStringReplace(const S: String; const OldPattern: String; const NewPattern: string; IgnoreCase : Boolean = False): String; overload;
procedure CustomStringReplace(var S : TStringList;const OldPattern: String;const NewPattern: string; IgnoreCase : Boolean = False); overload;
function ZenToHan(const s: string): string;
- function VaguePos(const Substr, S: string): Integer;
+ function VaguePos(const Substr: String; const S: string): Integer;
function ReplaseNoValidateChar( inVal : String): String;
function IsNoValidID( inID :String): Boolean;
//<font>\83^\83O\82ð\91S\82Ä\8dí\8f\9c\82·\82é
- function DeleteFontTag( inSource : string) : string;
- procedure DivideStrLine(Line: string; PRes: PResRec);
+ function DeleteFontTag( inSource : string) : string;
function RemoveToken(var s: string;const delimiter: string): string;
implementation
Result := nil;
end;
-{$R-}
//\8d\82\91¬\95¶\8e\9a\97ñ\92u\8a·\8aÖ\90\94\81i\91å\95¶\8e\9a\8f¬\95¶\8e\9a\82Ì\88á\82¢\82ð\96³\8e\8b\82µ\82È\82¢\81j
-function ReplaceString(const S: String; const OldPattern: String; const NewPattern: string): string;
+function ReplaceString(const S: String; const OldPattern: String; const NewPattern: string): String;
var
- ReplaceCount: Integer;
- DestIndex: Integer;
- i, l: Integer;
- p, e, ps, pe: PChar;
- Count: Integer;
+ ReplaceCount: Integer;
+ DestIndex: Integer;
+ i, l: Integer;
+ p, e, ps, pe: PChar;
+ Count: Integer;
+ olen: Integer;
begin
Result := S;
- if OldPattern = '' then Exit;
+ olen := Length(OldPattern);
+ if olen = 0 then Exit;
p := PChar(S);
e := p + Length(S);
ps := PChar(OldPattern);
- pe := ps + Length(OldPattern);
+ pe := ps + olen;
ReplaceCount := 0;
while p < e do begin
p := AnsiStrPosEx(p, e, ps, pe);
if p = nil then Break;
Inc(ReplaceCount);
- Inc(p, Length(OldPattern));
+ Inc(p, olen);
end;
if ReplaceCount = 0 then Exit;
SetString(Result, nil, Length(S) +
- (Length(NewPattern) - Length(OldPattern)) * ReplaceCount);
+ (Length(NewPattern) - olen) * ReplaceCount);
p := PChar(S);
DestIndex := 1;
l := Length( NewPattern );
Inc(p, Count);//p := pp;
Inc(DestIndex, Count);
Move(NewPattern[1], Result[DestIndex], l);
- Inc(p, Length(OldPattern));
+ Inc(p, olen);
Inc(DestIndex, l);
- end;
- Move(p^, Result[DestIndex], e - p);
+ end;
+ Move(p^, Result[DestIndex], e - p);
end;
//\8d\82\91¬\95¶\8e\9a\97ñ\92u\8a·\8aÖ\90\94\81i\91å\95¶\8e\9a\8f¬\95¶\8e\9a\82Ì\88á\82¢\82ð\96³\8e\8b\82·\82é\81j
-function IgnoCaseReplaceString(const S: String;const OldPattern:String;const NewPattern: string): string;
+function IgnoCaseReplaceString(const S: String;const OldPattern:String;const NewPattern: string): String;
var
ReplaceCount: Integer;
DestIndex: Integer;
end;
Move(p^, Result[DestIndex], e - p);
end;
-{$IFDEF DEBUG}
-{$R+}
-{$ENDIF}
-
//\8d\82\91¬\95¶\8e\9a\97ñ\92u\8a·\8aÖ\90\94\81i\94Ä\97p\94Å\82P\81j
function CustomStringReplace(
const S :String;
IgnoreCase : Boolean
): String;
begin
- Result := '';
if not IgnoreCase then begin
Result := ReplaceString(S,OldPattern,NewPattern);
end else begin
(*************************************************************************
* \91S\8ap\94¼\8ap\82Ð\82ç\82ª\82È\82©\82½\82©\82È\82ð\8bæ\95Ê\82µ\82È\82¢\90¦\82¢Pos
*************************************************************************)
-function VaguePos(const Substr, S: string): Integer;
+function VaguePos(const Substr:String; const S: string): Integer;
begin
Result := AnsiPos(ZenToHan(Substr), ZenToHan(S));
end;
end;
// *************************************************************************
-{!
-\brief dat\83t\83@\83C\83\8b\82Ì\88ê\83\89\83C\83\93\82ð\95ª\89ð
-\param Line dat\83t\83@\83C\83\8b\82ð\8d\\90¬\82·\82é 1 \8ds
-\return \83\8c\83X\8fî\95ñ
-}
-procedure DivideStrLine(Line: string; PRes: PResRec);
-const
- delimiter = '<>';
-var
- pds, pde : PChar;
- pss, pse : PChar;
- ppos : PChar;
-begin
- //\8cÅ\92è
- PRes.FType := glt2chNew;
-
- pss := PChar(Line);
- pse := pss + Length(Line);
- pds := PChar(delimiter);
- pde := pds + Length(delimiter);
-
- ppos := AnsiStrPosEx(pss, pse, pds, pde);
- if (ppos = nil) then begin
- Line := CustomStringReplace(Line, '<>', '<>');
- Line := CustomStringReplace(Line, ',', '<>');
- Line := CustomStringReplace(Line, '\81\97\81M', ',');
- end;
- //Trim\82µ\82Ä\82Í\82¢\82¯\82È\82¢\8bC\82ª\82·\82é\81@by\82à\82¶\82ã
- PRes.FName := RemoveToken(Line, delimiter);
- PRes.FMailTo := RemoveToken(Line, delimiter);
- PRes.FDateTime := RemoveToken(Line, delimiter);
- PRes.FBody := RemoveToken(Line, delimiter);
- //\82Q\82¿\82á\82ñ\82Ë\82é\82Æ\82©\82¾\82Æ\81A\96{\95¶\82Ì\90æ\93ª\82É\82P\82Â\94¼\8ap\8bó\94\92\82ª\93ü\82Á\82Ä\82¢\82é\82Ì\82Å\8dí\8f\9c\82·\82é
- //\91¼\82Ì\8cf\8e¦\94Â\82Å\81A\83\8c\83X\8e©\91Ì\82Ì\8bó\94\92\82©\82à\82µ\82ê\82È\82¢\82¯\82Ç\82»\82ê\82Í\92ú\82ß\82é
- PRes.FBody := TrimLeft(PRes.FBody);
- //\8bó\82¾\82Æ\96â\91è\82ª\8bN\82«\82é\82©\82ç\81A\8bó\94\92\82ð\90Ý\92è\82·\82é
- if PRes.FBody = '' then
- PRes.FBody := ' ';
-
- PRes.FTitle := RemoveToken(Line, delimiter);
-end;
(*************************************************************************
*