Hi all,
I have a question. I needed the use of listAppend. But it doesn't work so well. It even says on the livedocs that developers should not use listAppend in their code.
So I wrote my own listAppend kinda method called listAdd
CODE
<cffunction access="public" name="listAdd" output="false" returntype="String">
<cfargument name="list" type="String" required="true">
<cfargument name="value" type="string" required="true">
<cfargument name="delimiter" type="string" required="false" default=",">
<cfscript>
if(listLen(ARGUMENTS.list) eq 0) {
ARGUMENTS.list = ARGUMENTS.value;
} else {
ARGUMENTS.list = ARGUMENTS.list & ARGUMENTS.delimiter & ARGUMENTS.value;
}
return ARGUMENTS.list;
</cfscript>
</cffunction>
This all works fine. But I have a question, is it possible to do this without returning a value, because now I call this method like this:
CODE
hashList = listAdd(hashList, this.requestObject.getIdentifier().getHashCode());
I think it would be a cleaner code if it would do the same with just:
CODE
listAdd(hashList, this.requestObject.getIdentifier().getHashCode());
But as far as I know a string has it's value copied not the memory pointer. And because a list is a string it will never change the memory location. Just the copied value.
Is there a way to make this work? Ofcourse I want changes to the listAdd() method and not the call of this method if possible.
Cheers,
Rick