Forum > General

UpCase vs. UpperCase

(1/2) > >>

Pascal:
Which is best to use?

Noodly:
UpCase is more flexible as it works on chars as well as more string types than UpperCase.

Thaddy:

--- Quote from: Noodly on December 07, 2017, 08:04:32 am ---UpCase is more flexible as it works on chars as well as more string types than UpperCase.

--- End quote ---
Absolutely wrong, Not correct, they are completely equivalent:
   https://www.freepascal.org/docs-html/rtl/sysutils/uppercase.html
The most flexible one has the misleading name AnsiUpperCase which will work with any character set provided a string manager is installed: 
   https://www.freepascal.org/docs-html/rtl/sysutils/ansiuppercase.html

It is rather sad that both of you did not simply RTFM. <grumpy  >:D >:D>
The FPC manuals are excellent. Always read them first.

So: read those two links and you gain some expertise on the subject  ::)

Noodly:
Before posting I did RTFM and saw the "completely equivalent statement" in the UpperCase entry. In the context it's badly worded because if it's true then this would compile:


--- Code: ---program uptest;
uses sysutils;
var
  a,b : char;
begin
  a:='a';
  a:=UpCase(a);
  b:='b';
  b:=UpperCase(b);
end.   

--- End code ---

What the FM should say is that "UpperCase has been superseded by (and therefore can be replaced by) the more capable UpCase function and is provided for compatibility only" or words to that effect.

Zath:
Is there any reason why new coding to allow for new string formats can't be added to the original command name ?

Navigation

[0] Message Index

[#] Next page

Go to full version