This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
a
agoni
Post
by agoni » Sun Jan 06, 2002 4:19 pm
Hi i would like to know how to make percentage ? exemple a percentage of CAPS in a line.
i mean when someone type something in a channel how to know percentage of CAPS, or percentage of whatever you want
excuse my english :-/
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sun Jan 06, 2002 9:57 pm
The following code will tell you the percentage of caps
Code: Select all
proc PercentageCaps {string} {
set i [string length $string]
regsub -all -- {[A-Z]} $string string
return [expr ([string length $string] - ${i}) / $i]
}
Note: It returns it as a floating point value. Just multiply it by 100 to get the percentage
When you pass it the text from a channel message, it will return the percentage of Caps.