• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Delphi mTrim by Metal

Status
Not open for further replies.

Expermicid

Leech
User
Joined
Oct 23, 2011
Messages
285
Reputation
0
Reaction score
255
Points
63
Credits
0
‎13 Years of Service‎
95%
Ejemplos:

" Hola ", resultado: "Hola"

" Ho la ", resultado: "Ho la"

[lenguaje=delphi]function mTrim(Cadena: string):string;

var

Der: string;

Espacios: ShortInt;

iDer, iIzq, j, k: integer;

begin

iDer:= Length(Cadena);

iIzq:= 1;

for j:= Length(Cadena) downto 1 do

begin

Espacios:= pos(' ', Cadena[iDer]);

if Espacios = 1 then

dec(iDer);

Der:= copy(Cadena, 1, iDer);

end;

for k:= 1 to length(Der) do

begin

Espacios:= pos(' ', Cadena[iIzq]);

if Espacios = 1 then

inc(iIzq);

Result:= copy(Der, iIzq, Length(Der) - iIzq +1);

end;

end;[/lenguaje]

Autor: Metal_Kingdom

 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top