All pastes #571702 Raw Edit

AWESOME FILTERFILENAME FUNCTION

public text v1 · immutable
·published 2007-06-17 08:36 UTC
rendered paste body
function FilterFilename(const filename: string):string;
var
i,len: byte;
c: string;
begin
len := length(filename);
result := '';

for i := 1 to len do begin
	c := copy(filename,i,1);
	if (c='\') or (c='/') or (c=':') or (c='*') or (c='?') or (c='"') or (c='<') or (c='>') or (c='|') then
		result := result + '_'
	else
		result := result + c;
end;

end;