/ Published in: VB.NET
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
''' <summary> ''' Removes extra leading whitespace, trailing whitespace and inside whitespace ''' </summary> ''' <param name="_string">String to remove extra whitespace</param> ''' <returns>Cleaned string.</returns> ''' <remarks></remarks> Public Shared Function RemoveExtraWhitespace(ByVal _string As String) As String If (_string = Nothing Or _string = " ") Then Return Nothing End If Dim tempString As String = Nothing For Each stringElement In stringArray If (stringElement <> "") Then tempString += " " + stringElement End If Next tempString = tempString.Trim Return tempString End Function