end;
class function tstring.similarposition(aone, atwo: string): integer;
var
i: integer;
max: integer;
begin
if length(aone) < length(atwo) then
max := length(aone)
else
max := length(atwo);
for i := 1 to max do
begin
if aone[i] <> atwo[i] then
break;
end;
result := i;
end;
class function tstring.getcharnum(astring: string; achar: char): integer;
var
i: integer;
begin
result := 0;
for i := 1 to length(astring) do
begin
if astring[i] = achar then
inc(result);
end;
end;
class procedure tstring.getallwordwithall(avalue, aseparator: string;
astringlist: tstrings);
var
tmpi: integer;
tmppos: integer;
begin
if astringlist = nil then
astringlist := tstringlist.create;
tmppos := 0;
while length(avalue) > 0 do
begin
for tmpi := 1 to length(avalue) do
begin
tmppos := pos(avalue[tmppos], aseparator);
if tmppos > 0 then
begin
astringlist.add(copy(avalue, 1, tmppos - 1));
astringlist.add(copy(avalue, tmppos, 1));
delete(avalue, 1, tmppos);
break;
end
end;
end; // while
end;
class function tstring.tolowercase(astring: string): string;
begin
result := lowercase(astring);
end;
class function tstring.touppercase(astring: string): string;
begin
result := uppercase(astring);
end;
class function tstring.indexof(astring, asubstring: string): integer;
begin
result := pos(asubstring, astring);
end;
class function tstring.zerotoint(astring: string): integer;
begin
if trim(astring) = '' then
astring := '0';
result := strtoint(astring);
end;
class function tstring.zerotofloat(astring: string): double;
begin
if trim(astring) = '' then
astring := '0.0';
result := strtofloat(astring);
end;
class function tstring.sametext(astring, astring1: string): boolean;
begin
result := sysutils.sametext(astring, astring1);
end;
class function tstring.reverse(astring: string): string;
begin
result := reversestring(astring);
end;
class function tstring.isvalidip(const s: string): boolean;
var
j, i: integer;
ltmp: string;
begin
result := true;
ltmp := trim(s);
for i := 1 to 4 do begin
j := strtointdef(fetch(ltmp, '.'), -1);
result := result and (j > -1) and (j < 256);
if not result then begin
break;
end;
end;
end;
class function tstring.zerotostr(astring: string): string;
begin
if trim(astring) = '' then
result := '0'
else
result := astring;
end;
class function tstring.fillstring(achar: char; alength: integer): string;
var
i: integer;
begin
result := '';
for i := 1 to alength do // iterate
begin
result := result + achar;
end; // for
end;
class function tstring.stuffstring(const atext: string; astart,
alength: cardinal; const asubtext: string): string;
begin
result := strutils.stuffstring(atext, astart, alength, asubtext);
end;
class function tstring.getnextstring(var sourcestring: string;
asplitchar: string): string;
var
tmppos: integer;
begin
tmppos := pos(asplitchar, sourcestring);
if tmppos = 0 then
begin
result := sourcestring;
sourcestring := ''
end
else
begin
result := tstring.left(sourcestring, tmppos -1);
delete(sourcestring, 1, tmppos);
end;
end;
{ tinteger }
class function tinteger.inttostr(ainteger: integer): string;
begin
result := sysutils.inttostr(ainteger);
end;
class function tinteger.hashcode(ainteger: integer): integer;
begin