- procedure ExplodeConcat(Source, Splitter : String; ConcatStart : Integer ; var SList : TStringDynArray);
- var SplitPos : integer;
- SLenght : Integer;
- begin
- SetLength(SList,1);
- SLenght := 1;
-
- SList[0] := Source;
-
- repeat
- SplitPos := posfull(Splitter,Source,True)-1;
-
- Inc(SLenght);
- SetLength(Slist,SLenght);
-
- SList[SLenght-1] := Copy(Source,1,SplitPos);
- Delete(Source,1,SplitPos+1);
- until (Source = '') or (SLenght = ConcatStart);
-
- if ConcatStart = SLenght Then
- begin
- SetLength(SList,ConcatStart+1);
- SList[ConcatStart] := Source;
- end
- else
- if ConcatStart > SLenght Then
- begin
- SetLength(SList,ConcatStart);
-
- For SLenght := SLenght+1 to ConcatStart-1 Do
- SList[SLenght] := '';
- end;
- end;
-
-
- function HandleProtocols(Mess : String; protocols: array of string) : String;
- var Strings : TStringDynArray;
- I, J : integer;
- Pos1 :integer;
- begin
- ExplodeConcat(Mess,' ',-1,Strings);
-
- For I := 1 To length(Strings)-1 Do // mess complet
- begin
- Pos1 := pos('@',Strings[I]);
-
- if not (Pos1 = 0) and not (PosFrom('.',strings[I],Pos1) = 0) Then
- Strings[I] := '<a href="mailto:'+StringReplace(Strings[I],'"','',[rfReplaceAll])+'">'+Strings[I]+'</a>'
- else
- For J := 0 to Length(protocols)-1 Do
- begin
- Pos1 := Pos(protocols[J],Strings[I]);
-
- if Pos1 = 1 Then
- begin
- Strings[I] := '<a href="'+StringReplace(Strings[I],'"','',[rfReplaceAll])+'">'+Strings[I]+'</a>';
- Break;
- end;
- end;
-
- Result := Result+' '+strings[I];
- end;
-
- SetLength(Strings,0);
- end;
procedure ExplodeConcat(Source, Splitter : String; ConcatStart : Integer ; var SList : TStringDynArray);
var SplitPos : integer;
SLenght : Integer;
begin
SetLength(SList,1);
SLenght := 1;
SList[0] := Source;
repeat
SplitPos := posfull(Splitter,Source,True)-1;
Inc(SLenght);
SetLength(Slist,SLenght);
SList[SLenght-1] := Copy(Source,1,SplitPos);
Delete(Source,1,SplitPos+1);
until (Source = '') or (SLenght = ConcatStart);
if ConcatStart = SLenght Then
begin
SetLength(SList,ConcatStart+1);
SList[ConcatStart] := Source;
end
else
if ConcatStart > SLenght Then
begin
SetLength(SList,ConcatStart);
For SLenght := SLenght+1 to ConcatStart-1 Do
SList[SLenght] := '';
end;
end;
function HandleProtocols(Mess : String; protocols: array of string) : String;
var Strings : TStringDynArray;
I, J : integer;
Pos1 :integer;
begin
ExplodeConcat(Mess,' ',-1,Strings);
For I := 1 To length(Strings)-1 Do // mess complet
begin
Pos1 := pos('@',Strings[I]);
if not (Pos1 = 0) and not (PosFrom('.',strings[I],Pos1) = 0) Then
Strings[I] := '<a href="mailto:'+StringReplace(Strings[I],'"','',[rfReplaceAll])+'">'+Strings[I]+'</a>'
else
For J := 0 to Length(protocols)-1 Do
begin
Pos1 := Pos(protocols[J],Strings[I]);
if Pos1 = 1 Then
begin
Strings[I] := '<a href="'+StringReplace(Strings[I],'"','',[rfReplaceAll])+'">'+Strings[I]+'</a>';
Break;
end;
end;
Result := Result+' '+strings[I];
end;
SetLength(Strings,0);
end;