Delphi-Quellcode:
uses System.SysUtils;
procedure justReplacingThings();
const
formatStr = 'Hallo%sWelt';
var
dirtyString: String;
cleanedString: String;
badCharacter: Char;
charsTested: Integer;
begin
charsTested := 0;
for badCharacter := Low(Char) to High(Char) do begin
dirtyString := String.Format(formatStr, [badCharacter]);
cleanedString := dirtyString.Replace(badCharacter, EmptyStr);
if not (dirtyString <> cleanedString) then
WriteLn('Removing Character #', Ord(badCharacter), ' failed');
Inc(charsTested);
end;
WriteLn(charsTested, ' Characters tested');
end;
ergibt
Code:
Removing Character #0 failed
65536 Characters tested
Dann kann ich ja wieder ruhig schlafen.