DIGG IT!
6
Comments
Published
Wednesday, March 05, 2008
at
8:11 PM
.
If you find yourself working with data, you are bound to want to get a slice of a String. Most developers are aware of using positive integers with String.slice but I keep finding many are unfamiliar with using negative numbers.
Ted on Twitter - @AdobeTed
Ted on Adobe Groups
Ted on LinkedIn
Ted on Facebook
Ted at Adobe
We should also celebrate the fact AS3 now has great regular expression support.
var fileUrl:String = item.match(/install .(.+).$/)[1] as String;
Hmm, Python has this very same feature which is very cool. Good to know AS3s got it.
That code might read like that to a few but it's hideous in terms of code readability, maintainability and debug-ability. It's nothing but a developer ego trip.
anonymous,
Get over it, it works!
There are 1000's of ways to program some are clearly better than others but if it works it is hard to argue with it.
Ted :)
@Ted, your last comment should be law :)
I actually like how this is accomplished, thanks for sharing.
"Get over it, it works!
There are 1000's of ways to program some are clearly better than others but if it works it is hard to argue with it."
I do argue with it if it is hard to read and understand. Anything more than a one-time utility needs to be maintainable, and even the original author will not remember what clever thing they did in a week, let alone a month. Treat yourself as you would have others treat you and use obvious, commented code.
Cheers