Highly recommend against that. I intentionally used the less familiar and more complex Java object, because it will be significantly more performant as the string of DNA gets longer.
Java has a String "system", for lack of a better term, that is optimized for speed and memory utilization with static strings, at the expense of speed when manipulating strings. In particular, string operations such as len, mid, left, right, etc. are designed to be fast. Operations such as replace and concatenation are designed to be somewhat slower in order to make the first group faster. It's a tradeoff, but one that makes sense the vast majority of the time. StringBuffers (the object I used), on the other hand, are designed in "normal" fashion, without any particular optimizations for certain operations. Consequently they're a little slower for some operations than standard Strings, but they're much faster for other operations (in particular, concatenation). The designers of the Java language assumed that people who really care about efficiency will be intelligent enough to use the proper type (String or StringBuffer) based on what they're doing. By and large, I don't recommend mixing arbitrary Java into your CFML code, but the use of StringBuffers when you have massive string concatenation is definitely something to consider. Smart Java compilers may convert string concatenation into StringBuffers automatically to aid the developer. I have no idea if CF is that smart, so I explicitly tell CF what I want. Note that I'm talking about non-linear concatenation; linear concatenation is always done using StringBuffers, because there isn't actually a concatenation operator, every compiler will automatically convert it to some StringBuffer operations, from what I understand. cheers, barneyb On 6/14/05, Andrew Tyrone <[EMAIL PROTECTED]> wrote: > Using Barney's elegant struct solution, we can take it one step further by > creating a UDF and getting rid of the Java by using a new variable and > appending to it: > > <cfscript> > > function RevCompDNA(dna) { > > var newdna = ""; > var t = structNew(); > > t.c = "g"; > t.g = "c"; > t.a = "t"; > t.t = "a"; > > for (i = 1; i LTE Len(arguments.dna); i=i+1) { > > newdna = newdna & t[mid(dna, i, 1)]; > > } > > return newdna; > > } > > </cfscript> > > <cfoutput>#RevCompDNA("actg")#</cfoutput> > > > Andy -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209513 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54