Sponsored Link
改造・ソースとかのスレ
33:`)ノ:2003/10/05 19:58 ID:???
>32を修正版

function AddResTag(const S: string): string;
const        //レスを青くする
  ResS = WideString('1234567890-1234567890');
  TagS1= '<Font Color=Blue><u>';
  TagS2= '</u></Font>';
  Rs1 = WideString('>');
  Rs2 = WideString('>');
var
  p0, p1, p2, i : Integer;
  tmp, S1,S2 : WideString;
begin
  Result:= '';
  tmp:= S;

  while tmp<>'' do
  begin
   //>Resがあるか
   S1:='';
   p0:= length(tmp)+1;
   for i:=1 to length(ResS) do
   begin
    p1:= pos(Rs1 +ResS[i],tmp);
    p2:= Pos(Rs2 +ResS[i],tmp);
    if (p1>0) and (p0>p1) then begin p0:=p1; S1:=Rs1; end;
    if (p2>0) and (p0>p2) then begin p0:=p2; S1:=Rs2; end;
   end;

   if S1<>'' then //あったら
   begin
    //前の文字が>>だったら
    s2:= Copy(tmp,1,p0-1);
    while ((length(s2)>3) and (RightStr(s2,4)=Rs1)) or
       ((length(s2)>0) and (RightStr(s2,2)=Rs2)) do
    begin
      if RightStr(s2,4)=Rs1 then
      begin Delete(s2,length(s2)-3,4); S1 := Rs1+S1;end else
      if RightStr(s2,2)=Rs2 then
      begin Delete(S2,length(s2),1); S1 := Rs2+S1;end;
    end;

    Result:= Result +S2 +TagS1 +S1;
    Delete(tmp,1,length(s2)+length(S1));

    while (tmp<>'') and (pos(tmp[1],ResS)>0) do  //レス以外の文字まで
    begin
     Result := Result+tmp[1];
     Delete(tmp,1,1);
    end;
    Result:= Result +TagS2;
   end else //なし
   begin
    Result:= Result +tmp;
    exit;
   end;
  end;
end;
1:1- 2: 3:
4: 5: 6:
7: 8: 9:

Rainboard