[DUG] Why re-use when you can duplicate!
Pawel Rewak
pawel at practicalprograms.com
Mon Jun 4 14:05:47 NZST 2012
I appreciate your issue was with the "duplication" of the code, but is
there also not a performance issue with the second function call?
Result := CheckNumber(GetUnicodeCategory(S, Index))
should it not be
Result := CheckNumber(InternalGetUnicodeCategory(UCS4Char(C)))
?
On Sun, Jun 3, 2012 at 9:45 AM, Todd <todd.martin.nz at gmail.com> wrote:
> Is this a representative example of the code quality Embarcadero is
> producing today?
>
> class function TCharacter.IsNumber(C: Char): Boolean;
> begin
> if not IsLatin1(C) then
> Result := CheckNumber(InternalGetUnicodeCategory(UCS4Char(C)))
> else if not IsAscii(C) then
> Result := CheckNumber(InternalGetLatin1Category(C))
> else
> Result := (C >= '0') and (C <= '9');
> end;
>
> class function TCharacter.IsNumber(const S: string; Index: Integer):
> Boolean;
> var
> C: Char;
> begin
> CheckStringRange(S, Index);
> C := S[Index];
> if not IsLatin1(C) then
> Result := CheckNumber(GetUnicodeCategory(S, Index))
> else if not IsAscii(C) then
> Result := CheckNumber(InternalGetLatin1Category(C))
> else
> Result := (C >= '0') and (C <= '9');
> end;
>
> Todd.
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at listserver.123.net.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at listserver.123.net.nz with
> Subject: unsubscribe
>
--
Regards,
Pawel Rewak
Acumen Data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20120604/c62fd1e0/attachment-0001.html
More information about the Delphi
mailing list