Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 12th, 2006, 02:45 AM
Registered User
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kokuthanda Send a message via Yahoo to kokuthanda
Default javascript string Trim() frunction


Here is the smart Javascript function for remove additional spaces from a string using regular expressions

function Trim(s) {
    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (m == null) ? "" : m[1];

Enjoy and share this with your friends.

Suresh Kumar Thanda
Microsoft Application Developer
Sr .Net Developer
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
trim a string to the first character jd_erd Access 2 May 6th, 2007 11:01 PM
Trim a string in VBA lryckman Access VBA 2 January 19th, 2007 08:39 AM
Javascript to PHP string iwarlord PHP How-To 0 August 13th, 2006 11:13 PM
custom JavaScript Trim function crmpicco Javascript How-To 2 January 18th, 2006 12:53 PM
String.trim() mrfox BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 1 January 8th, 2006 12:23 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.