On Mon, 09 Aug 2004 18:24:33 +1000, Geoff Bowers wrote:
> You might try CFLIB.org for all your function needs:
> CapFirstTitle()
> TitleCaseList()
Here's another couple of techniques. One using regular expressions, one
using CSS.
The RegExp is not completely foolproof (as the example shows), but it saves
all that looping about the place that the CFLIB UDFs seem to like doing.
I think the CSS solution is the best one, to be honest.
<cfscript>
testStr = "this is a test sentence,it has punctuation and it's also got a
couple of apostrophe's (sic).the function should cap-first all words,i
hope.plural numbers like 2s and 3s seem to work,too,for some
reason.it,however,preserves wholly CAPITALISED word(s)";
regExp1 = "(^\b|[^\w'])(\w)";
regExp2 = "\1\u\2";
writeOutput(reReplace(testSTr, regExp1, regExp2, "ALL") & "<br />");
writeOutput('<span style="text-transform=capitalize">#testStr#</span><br
/>');
</cfscript>
--
Adam Cameron
Senior Application Developer
Straker Interactive
E: [EMAIL PROTECTED]
T: +64 9 3095252
F: +64 9 3092797
W: www.straker.co.nz
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/