[fpc-pascal]Strange Segfault...

James Mills prologic at daisy.ods.org
Sun Jul 13 16:47:27 CEST 2003


On Fri, Jul 11, 2003 at 06:41:22AM -0700, Jeff Pohlmeyer wrote:
> (*
>   How about using "set of char" instead of "array of char" ?
>   That way, the compiler should be able to distinguish
>   between the overloads...
> *)
> program repl;
> 
> type 
>   tSetOfChar = set of char;
> 
> procedure replace(chars: tSetOfChar; const replace: String; var s: String);
> var
>   i: Integer;
> begin
>   for i:=length(s) downto 1 do if (s[i] in chars) then begin
>     delete(s, i, 1);
>     insert(replace, s, i);
>   end;
> end;
> 
> var 
>   w, s:string;
> begin
>   s:='a1ebf2c3d45';
>   readln(w);
>   replace(['0'..'9'], w, s);
>   writeln(s);
> end.

Thank you, this worked quite well and is what I needed. And yes Matt
Emson, I do understand why my original functions weren't working :)

cheers
James

> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 
-
- James Mills
Zero Defect Software Engineers Group - ZDSEG




More information about the fpc-pascal mailing list