C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Remove Trailing and Extra Spaces/Non-Printing Characters


Posted Date: 03 Aug 2008    Resource Type: Code Snippets    Category: Validations
Author: RekhaMember Level: Gold    
Rating: Points: 10



Public Function TrimAll(ByVal TextIn As String, Optional ByVal TrimChar As String = " ", Optional ByVal CtrlChar As String = Chr(0)) As String

Try ' Replace ALL Duplicate Characters in String with a Single Instance
TrimAll = Replace(TextIn, TrimChar, CtrlChar) ' In case of CrLf etc.

While InStr(TrimAll, CtrlChar + CtrlChar) > 0
TrimAll = TrimAll.Replace(CtrlChar + CtrlChar, CtrlChar)
End While

TrimAll = TrimAll.Trim(CtrlChar) ' Trim Begining and End
TrimAll = TrimAll.Replace(CtrlChar, TrimChar) ' Replace with Original Trim Character(s)
Catch Exp As Exception
TrimAll = TextIn ' Justin Case
End Try

Return TrimAll

End Function




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Remove extra spaces and non-printing characters  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: force control not to validate
Previous Resource: Validating a URL(simple!!!!!!!!!!)
Return to Discussion Resource Index
Post New Resource
Category: Validations


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use