Remove Trailing and Extra Spaces/Non-Printing Characters from a String (VB.NET)

Category:
C#, VB.NET, ASP.NET
Type:
Snippets
Difficulty:
Beginning
Author:
Brian Gillham

Version Compatibility: Visual Basic.NET, ASP.NET

More information:
Again (I think) the function that VB forgot to add. This function will remove all those EXTRA spaces / characters in a string. My original TrimAll function (http://www.freevbcode.com/ShowCode.ASP?ID=2999) seemed to be quite popular around the 'Net so here is the VB.Net version.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: