> I have a variable containing a filename and I need to find out what > "dot-plus-three-letter" extension it has? (use right())
Three? You've been using DOS for too long ;-) httpd. foo.c foo.js foo.cfml Foo.class foo.properties Sorry... this sort of thing is the basis of my point (which I didn't clearly make, granted). It's foolhardly to ass-u-me that a file extension has three and only three letters. Even on Windows. It's whatever's after the last dot. If anything. If you worked for me and used right(s, 3) to extract a file extension, you'd be shot. (If you worked for me the issue of being shot would be the least of your worries, though, I guess ;-) > I have a variable containing a filename and I need to find out what, > if any, extension it has? (use listLast() probably) So yeah. This strikes me as being the most sensible option. Although... thanks to CF being silly with empty list items (why o why o why?!?!), it's still problematic if the file hasn't got a file extension, really, eh? Maybe a regex? sReplace = REReplace(sPath, "(.*\.)(.*)$", "\2"); // but won't work if there's no dot @ all. Maybe just a two step (if it ends in . then it's "", otherwise listLast()) > Yes, but it's always good to have an internal sanity check And that's all my responses to you are, right? I'm not having a go @ you. > before > immediately diving into using listXxx() functions on strings... I see > a lot of listGetAt() calls in code and that function is almost never > the right way to do things! Agreed. I think CF has made it too easy for people to fall back on treating stuff as a list, when there are better options. -- Adam --- 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/
