UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> Remove extra spaces    
(Difference between revisions)

Current revision


Removes leading and trailing spaces, in addition removes all 'extra' spaces between words.

' Remove extra spaces
' http://www.utteraccess.com/wiki/Remove_extra_spaces
' Code courtesy of UtterAccess Wiki
' Licensed under Creative Commons License
' http://creativecommons.org/licenses/by-sa/3.0/
' You are free to use this code in any application,
' provided this notice is left unchanged.
' rev  date                          brief descripton
' 1.0  2011-07-26                    
Public Function RemoveExtraSpaces(ByVal strText As String) As String
   Do Until InStr(1, strText, "  ") = 0
       strText = Replace(strText, "  ", " ", 1)
   RemoveExtraSpaces = Trim(strText)

End Function

Creative Commons License
Remove extra spaces by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search

Thank you for your support!
This page has been accessed 7,654 times.  This page was last modified 16:12, 26 July 2011 by Brent Spaulding.   Disclaimers