String function

bayman

Registered User.
Local time
Today, 13:08
Joined
May 25, 2001
Messages
96
Is there a simple string function to remove all instances of a specified character? For example, I have the string 'quick brown fox'. Is there a function which will let me strip the spaces to return 'quickbrownfox'?

Thanks in advance.
 
RemoveOMatic will do it:

Function Removeomatic(ByVal pstr As String, ByVal pchar As String) As String
'*******************************************
'Name: Removeomatic (Function)
'Purpose: Removed specified characters from a string.
'Inputs: from debug window: ? Removeomatic("123-45-6789", "-")
'Output: 123456789
'*******************************************

Dim strHold As String
strHold = RTrim(pstr)
Do While InStr(strHold, pchar) > 0
strHold = Left(strHold, InStr(strHold, pchar) - 1) & Mid(strHold, InStr(strHold, pchar) + 1)
Loop
Removeomatic = strHold
End Function
 
Awesome! Thanks.
 

Users who are viewing this thread

Back
Top Bottom