[fpc-pascal]Strange Segfault...
Jeff Pohlmeyer
yetanothergeek at yahoo.com
Fri Jul 11 15:41:22 CEST 2003
(*
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.
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
More information about the fpc-pascal
mailing list