Skip to main content
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Brad Wood
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Brad Wood ( @bdw429s )

Confirmed Availability Of Java String Methods In ColdFusion

By on

For anyone who follows my blog, you know that I LOVE using the underlying Java methods of ColdFusion objects. I had went back and forth with Ben Forta a bit about this, but apparently, Jason Delmore at MAX 2006 has confirmed that this is, in fact, a completely valid way to program in ColdFusion.

Freakin' sweet ass sweet! Java and ColdFusion is such a sexy couple. They might get the neighbors talking, but I know they're in it for the long haul.

Reader Comments


As I posted in another blog mentioning this exact same thing, if you need to do a lot of string manipulation, you should be using StringBuffer anyway as strings are immutable in Java.



While I think that java.lang.StringBuffer is awesome!, it doesn't do the same thing as java.lang.String. Specifically, it doesn't have String::ReplaceAll() and String::ReplaceFirst(). So, in cases where the "lots of manipulation" involves regular expressions, I can't really take advantage of the efficiency of the StringBuffer.


Using Java String methods in ColdFusion should be fine for the forseeable future, but I'd be careful of it even in the near term from the pure Compatibility point of view. BlueDragon.NET is not likely to use the same string methods, and I don't know if even BlueDragon.JAVA or Railo will allow you to use the Java String methods on arbitrary simple variables.



Interesting point... but out of curiousity, can one usually switch with ease to another programming language and have it be compatible. I know nothing about BlueDragon.Net or Railio so I am not sure what kind of compatability issues there are.


BlueDragon and Railo are non-Adobe implementations of the CFML language. They're 99% compatbile with CFML, but the implementation details are of course slightly different. BlueDragon has a version which is based on .NET instead of Java, and Railo distinguishes itself by outperforming Adobe's ColdFusion in most benchmarks.