• 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 mTrimLeft [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%
Es una alternativa al TrimLeft incluido en SysUtils.

La función que realiza es eliminar los espacios de la izquierda de una cadena (y solo los de la izquierda), si por ejemplo tenemos " hola", la función nos devuelve "hola", si tenemos " hola ", nos devolverá "hola ", lo que es eliminar los espacios vamos xD, si no hay espacios a la izquierda simplemente no modifica la cadena.

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

var

Espacios: ShortInt;

i, j: integer;

begin

i:= 1;

for j:= 1 to Length(Cadena) do

begin

Espacios:= pos(' ', Cadena);


if Espacios = 1 then



inc(i);



Result:= copy(Cadena, i, Length(Cadena) - i +1);



end;



end;[/lenguaje]


 


Autor: Metal_Kingdom


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