'********************************************************************

'*

'* Function RemoveExSpace

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2006-05-06

'* Modified: 2006-05-19

'*

'* Purpose: Remove Extra Spaces from the string.

'*

'* Input:   strAny = Any string

'*

'* Output: Returns the string with only one space between words and no

'*           spaces at the beginning or end of the string.

'*

'* Changes:

'* 2006-05-19: Complete rewrite using Replace function.

'********************************************************************

Function RemoveExSpace(ByVal strAny)

  'Version 2.0 2006-05-19

  strAny = Trim(strAny)

  Do While InStr(1, strAny, "  ", 0) > 0

    strAny = Replace(strAny, "  ", " ")

  Loop 'InStr(1, strAny, "  ", 0) > 0

 

  RemoveExSpace = strAny

 

End Function 'RemoveExSpace

Article ID: 413, Created On: 9/25/2011, Modified: 9/25/2011