String function (1 Viewer)

bayman

Registered User.
Local time
Today, 16:41
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.
 

raskew

AWF VIP
Local time
Today, 10:41
Joined
Jun 2, 2001
Messages
2,734
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
 

bayman

Registered User.
Local time
Today, 16:41
Joined
May 25, 2001
Messages
96
Awesome! Thanks.
 

Users who are viewing this thread

Top Bottom