[fpc-devel] FExpand function

Joao Morais post at joaomorais.com.br
Sun Mar 5 00:04:07 CET 2006


Michael Van Canneyt wrote:

> On Sat, 4 Mar 2006, Joao Morais wrote:
> 
>>Hello,
>>
>>Should this comparison (!) be fixed? Seeing that this code is going to
>>be changed, what about change Pa[I] assignment from a variable to a
>>constant?
> 
> The comparison can be fixed.
> 
> In fact I think the code can be reduced to a single loop:
> 
> if (DirectorySeparator='\') or (DirectorySeparator='/') then
>   for I:=1 to Length(PA) do
>     if (Pa[I] in ['\','/']) and (PA[I]<>DirectorySeparator) then
>       Pa[I]:=DirectorySeparator;
> 
> Could you test this, please ?

It works.
Perhaps you could use the in operator in the first if.

--
Joao Morais



More information about the fpc-devel mailing list