mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2010
Posts: 146
Masoud Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2010
Posts: 146
The $upper identifier passes all of these characters as upper case:

` 1 2 3 4 5 6 7 8 9 0 - = ; ' , . / \ ~ ! @ # $ % ^ & * ( ) _ + : " < > ? |

(We can make it correct by a simple program logic but this is so better if you do fix this identifier.)


Nothing...
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
$upper is not a true or false identifier, it merely turns your string into its uppercase equivalent.

//echo -a $upper(foo5) == FOO5

Similarly, and consistently:

//echo -a $upper(5) == 5

This is correct and intentional behaviour.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As argv0 mentioned, $upper just makes it uppercase. If you wanted to check if it's uppercase or lowercase, you'd use isupper or islower. Note that these do treat numbers/symbols as uppercase or lowercase, but I don't really think that should be changed. It can be useful to check if everything other than symbols/numbers is upper or lower. And if you wanted to check if something is upper (or lower) and doesn't include numbers/symbols, it's easy enough to check for isalpha as well.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Keep in mind that "isupper $1-" is really just doing $upper($1-) == $1-, so the behaviour will still be the same. Again, this is also intentional; and there's actually a lengthy discussion on this in another bug report/feature suggestion. A non-alpha character does not define an "upper" or "lower" property and is therefore ignored in these checks. Any other behaviour would be inconsistent and would not be idempotent ($upper($lower($1-)) should == $upper($1-)).


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2010
Posts: 146
Masoud Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2010
Posts: 146
Sorry guys, that was my bad, I meant $isupper not the $upper...


Nothing...
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Just a note for you so you don't run into issues later... there's no $ on isupper. smile


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
If you meant "isupper" (not $isupper), then please see the previously posted bug report on this issue linked in my last reply. Again, this is also not a bug, it is completely intentional and (as far as I know) unlikely to change.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2002
Posts: 87
Babel fish
Offline
Babel fish
Joined: Dec 2002
Posts: 87
As has already been stated, this will not likely change. However, you've also stated that a fix would be simple, so why not code one? Save it to a variable, strip everything from the string that is not an alpha character, then do the comparison. After that, proceed with the normal string. Simple enough.


-Zmodem
Joined: Mar 2010
Posts: 146
Masoud Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Mar 2010
Posts: 146
I was reading some posts and i saw you were say something...
Quote:
Just a note for you so you don't run into issues later... there's no $ on isupper. smile

Are you serious? I think you need to read /help $isupper
Of course we can check like this:
Code:
if (SomeTextHere isupper) { ... }

But this is not the ONLY way since we have $isupper()


Nothing...
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I think that the confusion is with the fact that the isupper comparator doesn't use the $, as the $isupper identifier does.

The fact that the two are almost identical in both functionality and coding (from the scripter's point of view, not necessarily internally) makes the confusion somewhat understandable.

In any case, the characters that you mentioned are not treated as either upper or lowercase. Possibly an amendment to the help file so that it reads something like
Quote:
$isupper(text) returns true if the alphabetic characters are upper case.

A similar change could also be put for $islower

Realistically only alphabetic characters can be upper or lower case, thus numerics and symbols would not qualify as either upper or lower case.

Joined: Dec 2002
Posts: 344
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Since this thread was bumped for some reason, and because some of the claims in this thread are incorrect, I'd suggest anyone looking for information on this subject to read through the following thread (Jaytea's post in particular):

https://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=225583&page=5#Post225583

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Noting the dates, I suspect that the reviver of this topic just thought that they had something relevant to post and didn't pay attention as to the age of the topic. I know I've been guilty of doing that, though I do try not to.


Link Copied to Clipboard