|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
Public Function String_PurgeWS(MyString As String) As String
'Purpose
' Used to remove all whitespace characters from a string.
'Parameters
' MyString (String) = The string we're working with.
'Version History
' 1.05/10/2006 9:42pm Tested by Russ Tanner on VB6 Win2000
'---
'Initiate variables
Dim WS() As Byte 'this is our list of characters that we consider whitespace
Dim i As Long 'iterator
Dim R As String 'return buffer
'Define the list of characters that we consider whitespace.
'The "C" standard library considers spaces and tabs to be whitespace.
ReDim WS(1)
WS(0) = 32
WS(1) = 9
'Preload the return buffer
R = MyString
'Main Loop: Loop through all characters that are considered whitespace
For i = 0 To UBound(WS)
R = Replace(R, Chr(WS(i)), "")
Next i
'Return result
String_PurgeWS = R
End Function
|
|
|
|
Entire Thread
|
Used to remove all whitespace characters from a string.
|
Russ
|
08/11/08 10:35 PM
|
|
|
|