Top

$iscaps - % of capital or lowercase


mIRC Code
+ 0 likes
Please Register to submit score.
Average Score  6.0
Scores Submitted  3
Date Added  Jun 07, 2008
Last Updated  Aug 27, 2008
Tags  capital  iscaps  isid  lowercase  percent  prop  regex 
  Bookmark and Share

Introduction

The below snippet with tell you the percentage of capital letters , lowercase letters or both. It will only take into account letters in the string being checked.


Update: Removed variables and placed $regex inside $calc itself. Also made the % optional for each version. ( June 9th '08 )

Update: Redid the code a bit to make it shorter and easier to use. ( August 27th '08 )

;http://www.hawkee.com/snippet/3325/ ( based off of )
;--- Usage ----------------
;--- $iscaps(string).u <-- %caps
;--- $iscaps(string).up <-- %caps /w % after number
;--- $iscaps(string).l <-- %lowercase
;--- $iscaps(string).lp <-- %lowercase /w % after number
;--- $iscaps(string) <-- %caps , %lowercase
;--- $iscaps(string).p <-- %caps , %lowercase /w % after numbers
;--------------------------



Grab the Code

Comments

  (8)  RSS
EL
Comments: 1,382
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 7, 2008 10:37 pm
Nice work Scakk.`-.-´
vaseline28
Comments: 154
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 8, 2008 12:16 pm
Nice work also.

You say in introduction the usage is:
$iscaps().ul
But in the script it seems as though the usage for that is just $iscaps()
Scakk
Comments: 237
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 8, 2008 12:34 pm
It was .ul at one time but later I changed to not need that. Got it correct in the snippet itself. Changed it in the introduction part now. Thanks for the heads up.
Bahamut
Comments: 5
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 8, 2008 11:28 pm
Eh, it works at the very least, but the coding is not really stunning. Perhaps only declare variables once? Also, there are some letters you are missing support for (A-ZŠŒŽÀ-ÖØ-ÞŸ).

Now besides the coding: I find that adding a % to the end of the returned value is completely useless. What if I wanted to use this for a caps kicker? I'd have to use $remove or $left or so.

But in any case, this is a nice example of regex and how it can be used. Perhaps add a .count property to return the total matches (basically without a percentage)? Good luck.
^Neptune
Comments: 340
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 9, 2008 1:25 am
Damn it, this is great.
I really want to learn regex but not sure how :(
vaseline28
Comments: 154
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 9, 2008 1:37 am
Scakk
Comments: 237
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 9, 2008 4:52 am
Bahamut: Varaiables are now more as I have placed the $regex itself inside the $calc. Also made the % option for each version.
vaseline28
Comments: 154
 
mIRC Snippet:  $iscaps - % of capital or lowercase
Posted on Jun 11, 2008 11:21 am
Much neater now as you said on IRC! I think it deserves a higher rating now, great work!

Please Register or Login to start posting comments.
Bottom