not necessarily better...but an alternative could be:
<cfset myLetter="q" />
<cfif refind('[A-Z]', myLetter) GT 0>
uppercase
<cfelseif refind('[a-z]', myLetter) GT 0>
lowercase
<cfelse>
i have no idea
</cfif>
reFind() is case-sensitive.
or to UDF it:
<cfscript>
function getCase(letter) {
var returnstring = "";
if (refind('[A-Z]', letter) GT 0) {
returnstring = "uppercase";
} else if (refind('[a-z]', letter) GT 0) {
returnstring = "lowercase";
} else {
returnstring = "i have no idea";
}
return returnstring;
}
</cfscript>
<cfset myLetter = "Q" />
<cfoutput>#getCase(myLetter)#</cfoutput>
On 11/17/05, J W <[EMAIL PROTECTED]> wrote:
> IS there a better way to find out if a character is Upper or lowercase other
> than
>
> <cfif (Asc(X) gte 65) and (Asc(X) lte 90)> or
> <cfif (Asc(X) gte 97) and (Asc(X) lte 122)> where X is the letter I am
> comparing???
>
> I've seen some sample code of making a CF function for ISUpperCase and
> IsLowerCase. It uses the above technique.
>
> I figured I would throw it out there if there was another more effecient
> way.
>
> Thanks!
> Jeff
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:224538
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54