Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

TrimEx function using Regular Expression.

Total Hit ( 3284)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Regular Trim function only removes preceding and trailing space but it does not remove all other white space characters e.g. New Line(\n), Carraige return(\r), Form Feed(\f), Tab(\t). To remove these characters you can easily implement function using Regular expression.

Click here to copy the following block
Function TrimEx(ByVal inString As String) As String
  Dim reg1 As String = "^(\s*)([\W\w]*)(\b\s*$)"
  'Create a regular expression object
  Dim re As New System.Text.RegularExpressions.Regex(reg1)

  'Use the replace method to perform the formatting
  TrimEx = re.Replace(inString, "$2")
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.