Personally, I would return an empty array, with one empty element, the rationale being:
if you passed it: 12345qwerty you would get back exactly what you passed in, but as the first element in an array. so if you passed it: [empty string] shouldnt the behaviour be the same? (not that cold fusion agrees with this rationale...) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dawson, Michael Sent: 03 December 2004 19:02 To: [EMAIL PROTECTED] Subject: [CFCDev] Check for Empty Strings in Required String Arguments How many of you check for empty strings in required string-type arguments? For example, I have this function: <cffunction name="mySplit" return="array" ...> <cfargument name="myList" type="string" required="yes"> <cfreturn listToArray(arguments.myList, ",")> </cffunction> Then, I call the function like this: <cfset result = mySplit("")> Do you let this function return an empty array or do you throw an error? What is the general consensus? Should empty strings _always_ be allowed since they tend to be an exception to required arguments? Thanks M!ke ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at [EMAIL PROTECTED] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at [EMAIL PROTECTED]
