Before having some are, study explains writes the registration machine-hour to write, some are I rewrite certain brothers' code to come, writes more than many does not advise:
{=======================================================
The study explains, writes the registration machine some function collection
By: Dark night rainbow
========================================================}
function wzwgp (s: string): string; // takes the accumulation value
var i, sum:integer;
begin
sum:=0; for i:=1 to length(s) do
begin
sum:=sum+ord(s[i]);
end;
Result: =inttostr(sum);
end;
function ASCII10ADD (s: string): string; // takes the accumulation value
var i, sum:integer;
begin
sum:=0; for i:=1 to length(s) do
begin
sum:=sum+ord(s[i]);
end;
Result: =inttostr(sum);
end;
function ASCII16ADD (s: string): string; // takes the accumulation value
var i, sum:integer;
begin
sum:=0; for i:=1 to length(s) do
begin
sum:=sum+ord(s[i]);
end;
Result: =inttohex(sum,2);
end;
function float (a:integer): string;
var i:integer;
s:Extended;
begin
s:=0;
i:=1;
for i:=1 to a do
begin
s:=s + 1/i;
end;
result:=FloatToStr(s);
end;
function float2 (a:integer): string; // floating point mathematics operation
var i:integer;
s:Extended;
begin
s:=0;
i:=1;
for i:=1 to a do
begin
if i mod 2 <>0 then
s:=s + 1/i
else
s:=s - 1/i;
end;
result:=FloatToStr(s);
end;
procedure TForm1.Button2Click (Sender: TObject);
begin
edit2.text:=float2(100);
end;
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
function StrToBack (s: string): string; // reverses the string of character
var i:integer;
begin
for i:=1 to length(s) do
begin
result: =s[i]+result;
end;
end;
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
function mdistr (str:string; int:integer): string; // takes the string of character the middle part
begin
if int<Length(str)div 2 then
result:=copy(str, length(str) div 2, int)
else
result:=copy(str, Length(str) div 2-(int-Length(str) div 2), int);
end;
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
function StrToASCII16 (s: string): string; // string of character transforms the ascii code 16 to enter the system
var i:integer;
begin
for i:=1 to length(s) do
begin
result: = result + IntToHex(ord(s[i]),2);
end;
end;
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
Other pages: : 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * Next>>
|