oIn Delphi SysUtils is a ScanBlanks
procedure:
procedure ScanBlanks(const S: string; var Pos: Integer);
var
I: Integer;
begin
I := Pos;
while (I <= Length(S)) and (S[I] = ' ') do Inc(I);
Pos := I;
end;
I wonder why the procedure is using I
variable. Can't we use use Pos
var directly?
procedure ScanBlanks(const S: string; var Pos: Integer);
begin
while (Pos <= Length(S)) and (S[Pos] = ' ') do Inc(Pos);
end;
Is it because of some speed/memory penalty? Can someone more experienced explain me the reason/difference?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With