[thelist] ColdFusion List Functions - tip
jeff
jeff at members.evolt.org
Thu Dec 7 19:28:35 CST 2000
David,
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: David Shadovitz
:
: I've seen code using the Replace function to
: replace that double comma ",," with ",-," ...
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't forget that you'll need to do two replaces in case you have two or
more list elements next to each other that are null.
<cfset first_name = "Bob,,,Jim">
Replace(first_name, ",,", ", ,", "ALL")
first_name: Bob, ,,Jim
Replace(Replace(first_name, ",,", ", ,", "ALL"), ",,", ", ,", "ALL")
first_name: Bob, , ,Jim
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Use this SQL statement:
: select EmployeeID, FirstName,
: IIF(IsNull(MiddleInitial),'-',MiddleInitial) as MidInitial,
: LastName
: from Employees
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
better yet, replace nulls with a space (as you can see in my example above).
then, all you have to do when working with the data is Trim() it and it'll
be back to what you're expecting to work with (potentially nothing), but
your list functions will now operate correctly.
btw, great tip david, thanks.
thanks,
.jeff
name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org
More information about the thelist
mailing list