This is nothing new or shocking, but I thought I’d post it anyway.  When you’re dealing with ColdFusion content, you have available a number of exposed Java string methods that can be used in addition to the functions that CF provides.  You don’t have to invoke any Java objects or nonsense like that–simply call the method and see what happens.

Of course, many from the full list of Java string methods are either already familiar via CF functions or can be replicated quite easily by CF-only functions.  Nonetheless, I thought I’d share a quick roundup of what I think are some of the more interesting, along with simple examples of how to use them.  I hope you enjoy this Bleach-inspired sampling

Method Code Result charat
value = 'Bleach is awesome';
value.charat(3);
3 concat
value = 'Bleach is awesome';
addtl = ' because of the epic battle sequences';
value.concat(addtl)
Bleach is awesome because of the epic battle sequences contains
value = 'Ichigo Kurosaki';
value.contains('saki');
Yes endswith (case sensitive)
value = 'Zanpakutou';
value.endswith('tou');
Yes lastindexof
value = 'You can catch new episodes of Bleach on crunchyroll.com,
but only if you have a membership for which you pay each month';
value.lastindexof('you');
101 split
value = 'Shinigami|Bount|Hollow';
value.split('|');
[Shinigami,Bount,Hollow] startswith (case sensitive) More >