1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| function CheckDecimalSeparator(const S: string): string;
begin
Result := S;
ReplaceChar(Result, ',', DecimalSeparator);
ReplaceChar(Result, '.', DecimalSeparator);
end;
{* -----------------------------------------------------------------------------
la procédure ReplaceChar remplace dans S le caractère OldChar par le caractère NewChar
@param S chaine à modifier
@param OldChar caractère à remplacer
@parem NewChar caractère de substitution
------------------------------------------------------------------------------ }
procedure ReplaceChar(var S: string; const OldChar, NewChar: Char);
var
i: Integer;
p: PChar;
begin
if OldChar = NewChar then Exit;
p := @S[1];
for i := 0 to Length(S)-1 do
begin
if PChar(p+i)^ = OldChar then
PChar(p+i)^ := NewChar;
end;
end; |
Partager