This one returns the percentage of the string that is uppercase. The string explains my enthusiasm. ;)
<cfscript> function ucasePercentage(str) { ucount = 0; ufinder = refind("[A-Z]", str); while (ufinder neq 0) { ucount = ucount + 1; ufinder = refind("[A-Z]", str, ufinder+1); } return round((ucount / len(str)) * 100); } </cfscript> <cfset strng = "I Think I Am Having Way Too Much Fun With This Little Script. It's Probably Because I've Been Forced To Write Nothing But .NET Code For The Past Two Months. I Think My Project Manager Hates Me! LOL!"> <cfoutput> #ucasePercentage(strng)#% of this string is made up of uppercase characters. </cfoutput> So now you can come up with what percentage of the string you want to allow as uppercase and just check to see if #ucasePercentage(string)# is less than that number. I don't know what kind of posts your users are making but be aware that something like 'LOL' is 100% uppercase and probably legit. You may also consider only checking for the uppercase percentage once the string is longer than a specific number. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -----Original Message----- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Sunday, October 30, 2005 12:40 PM To: CF-Talk Subject: RE: SHOUTING Here ya go... <cfscript> function ucasecount(str) { ucount = 0; ufinder = refind("[A-Z]", str); while (ufinder neq 0) { ucount = ucount + 1; ufinder = refind("[A-Z]", str, ufinder+1); } return ucount; } </cfscript> <cfset strng = "AbCdEfGhI"> <cfoutput>#ucasecount(strng)#</cfoutput> The function returns a single numeric value. It's the number of uppercase characters found in the string. (In the example string... 5). You could easily add more to it such as getting the actual percent of uppercase characters that the number represents but the easiest way would be to just see if it's more than half the characters and do what you need to do. Example: <cfset tooMnayUC = len(trim(strng)) lt (ucasecount(strng)*2)> The string is #len(strng)# characters long. Out of those #len(strng)# characters, #ucasecount(strng)# characters are uppercase.<br><br> Are there too many uppercase characters? <b>#tooMnayUC#</b> ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.6/151 - Release Date: 10/28/2005 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222664 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54