IsUpper deprecated, twice

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

IsUpper deprecated, twice

Postby smd » Thu May 14, 2015 11:24 pm

I initially used IsUpper to test whether a Unicode character is upper case.
The compiler warns that it is deprecated. The wonderfully indexed help system (insert AAARRRGHH here) states to use TCharacter::IsUpper() instead.

So I put TCharacter::IsUpper() into my code. The compiler comes back and states that TCharacter is deprecated and to use TCharHelper.

TCharHelper is not recognized by the C++ compiler.

So (insert nsfw statements here) what do I use?
-----------------------------
Scott
smd
BCBJ Guru
BCBJ Guru
 
Posts: 130
Joined: Sat Nov 29, 2014 8:02 pm
Location: Las Vegas

Re: IsUpper deprecated, twice

Postby HsiaLin » Fri May 15, 2015 1:45 am

Did you add the declaration to your form...im assuming it would be:

#include <System.Character.hpp>

I think the usage is something like



char t;
...
if(t.IsUpper())
......
HsiaLin
BCBJ Master
BCBJ Master
 
Posts: 299
Joined: Sun Jul 08, 2007 6:29 pm

Re: IsUpper deprecated, twice

Postby rlebeau » Fri May 15, 2015 12:02 pm

HsiaLin wrote:I think the usage is something like



char t;
...
if(t.IsUpper())
......


That only works in Delphi, not in C++. Class helpers do not exist in C++, and certainly not for fundamental data types. That is a Delphi-only feature. So TCharHelper functionality cannot be used in C++ at all. You will have to keep using the deprecated IsUpper() functions, or find another solution that is not based on the Delphi RTL, such as the C runtime isupper() and iswupper() functions.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1533
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: IsUpper deprecated, twice

Postby smd » Fri May 15, 2015 3:39 pm

Looking at the standard C library (my preference anyway), looks as though the iswupper() simply accommodates wide characters, but only checks for ASCII capitalization. Supposedly the IsUpper() routines discriminate various alphabets, such as Russian, accented latin characters, and such. Russian has a few more characters than the english alphabet, and the standard library isupper() only looks at the 26 upper case ASCII characters.
-----------------------------
Scott
smd
BCBJ Guru
BCBJ Guru
 
Posts: 130
Joined: Sat Nov 29, 2014 8:02 pm
Location: Las Vegas

Re: IsUpper deprecated, twice

Postby rlebeau » Sat May 16, 2015 9:57 am

smd wrote:Looking at the standard C library (my preference anyway), looks as though the iswupper() simply accommodates wide characters, but only checks for ASCII capitalization.


Actually, it is locale-aware. In the default C locale, it only checks for ASCII capitals, yes. But you can use setlocale() beforehand to choose a different locale with different capitalization rules.

smd wrote:Supposedly the IsUpper() routines discriminate various alphabets, such as Russian, accented latin characters, and such.


Yes, and the available classifications are hard-coded in a lookup table resource that TCharacter uses internally.

smd wrote:the standard library isupper() only looks at the 26 upper case ASCII characters.


That is locale dependent.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1533
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: IsUpper deprecated, twice

Postby smd » Sat May 16, 2015 10:43 am

problem with locale aware is that a single document may have multiple languages. What we need is an isupper() that works correctly with utf-8.
-----------------------------
Scott
smd
BCBJ Guru
BCBJ Guru
 
Posts: 130
Joined: Sat Nov 29, 2014 8:02 pm
Location: Las Vegas


Return to Technical

Who is online

Users browsing this forum: No registered users and 12 guests