All pastes #104757 Raw Edit

Untitled

public java v1 · immutable
#104757 ·published 2006-07-29 05:50 UTC
rendered paste body
	<cffunction name="alphaCap" returntype="string" output="true" access="public">		<cfargument name="str" required="yes" type="string">		<cfscript>		// cap and lowers string handed to it (for titles and such)			var result ='';			lst_exception = 'an,the,at,by,for,of,in,up,on,to,and,as,but,if,or,nor,a';			for(i=1; i lte ListLen(trim(str),' '); i=i+1) {				str_first = '';				str_last = '';				str_word = ListGetAt(Trim(str),i,' ');				count = len(trim(str_word));				ar = ArrayNew(1);				// create a localized instance of array class				ar = server.obj.ar.StringToArray(trim(str_word));				for(j=1; j LTE count; j=j+1) { 					if(ar[1] IS ar[j]) { 						if(i NEQ 1 AND listfind(lst_exception,str_word,',') GT 0) { 							str_first = ar[1];						} else { 							str_first = UCase(ar[1]);						}					} else { 						str_last = str_last & lcase(ar[j]);					}				str_temp = str_first & str_last;				}				result = result & ' ' & str_temp;			}			return trim(result);		</cfscript>	</cffunction>