Dump or Add html Non-Breaking Spaces and Return Blanks - January 2009

The tip-of-the-month provides several functions in two modules that add or remove the non-breaking space html tag [ ] from text or return a number of these characters in a string. Sometimes empty grid columns return a non-breaking space character. I wrote these routines to handle removing or adding the characters. The modules and their functions:

Module/Comment Function Operands Sample Default
modDumpnbsp.vb
Remove and replace with fill character. Dumpnbsp sValue As String [,sFillCharacter] Dim sString as String = Dumpnbsp(sString) Empty String
Replace blanks with the non-breaking space. Addnbsp sValue As String Dim sString As String = Addnbsp(sString)  
modSomeBlanks.vb
Return a number of non-breaking characters SomeBlanks [ByVal iNumber As Integer] Dim sSpaces As String = SomeBlanks(3) 1
Alias for SomeBlanks SomeSpaces An alias for SomeBlanks    

Companion Function 'emt'

The October 2009 tip describes a function which works with these functions. Function 'emt' checks values to determine if they are null or blank. Click here to view that tip.

Download VB.Net Code

Click here to download the 'emt' function which contains the above described functions.

Previous Tip   Tip Index   Next Tip

Home

Updated 2011/04/16