Obvious yet useful
Every programmer needs to have some of those completely obvious and simple functions taken care of in their toy box. Here's one that I programmed 1000x before realizing I should really code it once and be done: public static String nvlb(String source, String falseCase) { if (source == null || source.equals("")) return falseCase; else return source; } Put this as a static member of your class and you'll never need to code out replacing a null or blank string to throw into some sql again. It will eliminate some keystrokes, but ranks high on the DUH factor :)
0 Comments:
Post a Comment
<< Home