Home
2011-11-24 04:53:05
Hello, I think that this function was requested by mastaraymond.
This will compare 2 strings and Result accuracy as a percent.
We could use this as an addition to IsUpText function what we currently have.
As you can see it will LowerCase whole word and it will make both words same length (by "Text Variable) I have tested it and it works.
~Home
This will compare 2 strings and Result accuracy as a percent.
We could use this as an addition to IsUpText function what we currently have.
function StringMatch(Text, rs_UpText: string): Extended;
var
i, High: Integer;
ii: Extended;
begin
High := Length(Text);
SetLength(rs_UpText, High);
ii := -1;
for i := 1 to High do
if (Pos(LowerCase(Text[i]), LowerCase(rs_UpText[i])) <> 0) then
ii := ii + (100.0 / High);
if ii > 0 then
Result := ii + 1.0
else
Result := 0.0;
end;
begin
Writeln(ToStr(StringMatch('Walk here', 'Walk her3eeeeeee')));
end.
As you can see it will LowerCase whole word and it will make both words same length (by "Text Variable) I have tested it and it works.
~Home