Checking a String for Empty with Function 'emt' - October 2009

Sometimes a very simple function can save a lot of keystrokes. I got tired of typing 'String.IsNullOrEmpty' and decided to replace the function with 'emt'. I added function 'Dumpnbsp' to the function. This is the entire 'emt' function:

Public Function emt(ByVal sValue) As Boolean
    sValue = Dumpnbsp(sValue).Trim
    If String.IsNullOrEmpty(sValue) Then Return True
End Function

Function Dumpnbsp

Function Dumpnbsp is described in the January 2009 tip. Click here to view that tip. Dumpnbsp removes all ' ' instances from a string. Dumpnbsp is included in the zipped file along with function 'emt'.

Function Addnbsp

Function Addnbsp is also described in the January 2009 tip. Click here to view that tip. Addnbsp replaces blanks with ' '. Addnbsp prevents strings from breaking when displayed in html pages.

Download VB.Net Code

Download - VS2008 Zipped File

 Size 

Function 'emt' emt.zip 2k

Previous Tip   Tip Index    Next Tip

Home

Updated 2011/04/16