Tip Bank

DevX - Software Development Resource

Checking for Null After New (2)

Normally, you should not check for null after creating an object. MyObject o = new MyObject(); This check is not required in Java because ‘new’ is not allowed to return

DevX - Software Development Resource

Test for Alpha Characters Only, Part II

I have a much simpler form for the IsAlphaNum function: Public Function IsAlphaNum(ByVal sString _As String) As BooleanIf Not sString Like “*[!0-9A-Za-z]*” _Then IsAlphaNum = TrueEnd Function You can modify

DevX - Software Development Resource

Test for Alpha Characters Only

Although VB has an IsNumeric function, it has no IsAlpha function. Use this routine whenever you want to determine whether a character or string of characters is alphabetic (A-Z or

DevX - Software Development Resource

Using “Blank” Final Data Members

Blank finals are fields that are declared as final, but are not given an initialization value. Java allows the creation of blank finals, but, in all cases, the blank final

DevX - Software Development Resource

Counting Bits Efficiently

Sometimes you need to know the number of bits set in a word. I often see code to count the number set bits written as a loop, processing one bit