Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base

Post new topic   Reply to topic
TrimEx
View previous topic :: View next topic  
Author Message
Gilad_r
Centurion


Joined: 03 Mar 2004
Posts: 156

PostPosted: Apr 21st, 2004 09:35 PM    Post subject: TrimEx Reply with quote

trim those extra spaces right out... :thumbs:
[vb:1:1fa034202a]Private Function TrimEx(ByVal sText As String) As String

Dim p As Long

sText = Trim$(sText)

p = InStr(1, sText, " ")
If p = 0 Then TrimEx = sText: Exit Function

TrimEx = Left$(sText, p) & TrimEx(Mid$(sText, p + 2, Len(sText) - p - 1))

End Function[/vb:1:1fa034202a]
_________________
"you should make amends with you" (Incubus)
Back to top
View user's profile Send private message
Andir
Centurion


Joined: 21 Dec 2003
Posts: 184
Location: Chicago Area

PostPosted: Apr 21st, 2004 09:53 PM    Post subject: Reply with quote

Side Note:
For those not aware, Trim() removes the leading and trailing spaces. How is this function different? Well, this removes all those dastardly "double-spaces" and reduces all that whitespace down to a single space.

Just don't let your typing teacher see it (remember, 2 spaces after each sentence) ^_^
_________________
If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too.
Back to top
View user's profile Send private message
Gilad_r
Centurion


Joined: 03 Mar 2004
Posts: 156

PostPosted: Apr 21st, 2004 10:22 PM    Post subject: Reply with quote

lol, yeah, i probably should have explained a bit more...
thanks!
_________________
"you should make amends with you" (Incubus)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic