Rick, Actually, I've noticed before that the search on there doesn't find what you're always looking for when you have more than one search term. I don't know why, but I've learned to make my searches simple on cflib.org. In this case, I just searched on "trim".
One time I had the hardest time finding a function I KNEW was on there and ended up having to search on "url" and going through the 42 results to find what I wanted. I'm not suer how it really works as I thought it might ONLY search the actual function name and not the text or description because if you also search on "trimstruct" you find that function, but you also find "liststruct"? Anyone have any insight as to what the deal is with that search function on cflib.org? Maybe the writer of it is on this list? Dave -----Original Message----- From: Rick Root [mailto:[EMAIL PROTECTED] Sent: Friday, July 22, 2005 3:55 PM To: CF-Talk Subject: Re: trimStructValues Cool. I actually searched cflib for "trim structure" and "trim struct" before writing mine! I guess I should've googled instead of using the search feature on cflib. Rick [EMAIL PROTECTED] wrote: > Rick, > > This one is on www.cflib.org: > > <cfscript> > /** > * Trims spaces from all keys in a structure. > * Version 2 by Raymond Camden > * Version 3 by author - he mentioned the need for isSimpleValue > * > * @param st Structure to trim. (Required) > * @param excludeList List of keys to exclude. (Optional) > * @return Returns a structure. > * @author Mike Gillespie ([EMAIL PROTECTED]) > * @version 3, July 11, 2002 > */ > function TrimStruct(st) { > var excludeList = ""; > var key = ""; > > if(arrayLen(arguments) gte 2) excludeList = arguments[2]; > for(key in st) { > if(not listFindNoCase(excludeList,key) and > isSimpleValue(st[key])) st[key] = trim(st[key]); > } > return st; > } > </cfscript> > > > -----Original Message----- > From: Rick Root [mailto:[EMAIL PROTECTED] > Sent: Friday, July 22, 2005 3:24 PM > To: CF-Talk > Subject: trimStructValues > > > Does anyone have any comments on this? I was looking for a way to > easily trim all of the simple values in a structure and came up with the > following, which I thought would be useful for trimming scopes like the > form scope or the arguments scope. > > It seems to work. > > Rick > > > <cffunction name="trimStructValues" access="public" output="no" > returnType="struct"> > <cfargument name="myStruct" type="struct" required="yes"> > <cfargument name="recurse" type="boolean" required="no" default="false"> > <cfscript> > var cnt = 1; > var myKeys = StructKeyArray(myStruct); > var myKey = ""; > > for (cnt=1;cnt LTE arrayLen(myKeys); cnt = cnt + 1) > { > myKey = myKeys[cnt]; > if (isSimpleValue(myStruct[mykey])) > { > myStruct[mykey] = trim(myStruct[mykey]); > } else if ( isStruct(myStruct[mykey]) AND recurse) { > myStruct[myKey] = trimStructValues(myStruct[myKey]); > } > } > return myStruct; > </cfscript> > </cffunction> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:212644 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

