Jump to content

How To: Trim White Space off of a String ???


webtest

Recommended Posts

Esteemed Forum Participants and Lurkers:===========================Adobe Acrobat 5.0 - Forms: Control Custom Validate ScriptI am an absolute newbie to JS, but am an otherwise fairly experienced old hacker in many languages. I have tested in MS VBA (Visual Basic for Applications - Excel) a function to validate user entered UPC codes in an Excel Cell. I'm attempting to move this into an Adobe Acrobat Form to validate the entry in a control. I have converted quite a bit of the code, thanks to the w3schools site, but here is my first dead end ...VBA:'Remove all whitespace from beginning and end of a string' leaves string with first and last characters as printable charactersmyString = Trim(myString)JS ... ???My sincere appreciation for helping me get started. Thank you for any and all comments, suggestions, and assistance in this effort.Blessings in abundance, all the best, and ENJOY!Art . . . Carlisle, PA . . . USA

Link to comment
Share on other sites

Thank you "aalbetski", but it isn't just spaces ... "Trim" cuts off spaces, tabs, new-lines [chr(10)], etc. ... anything that isn't a printable character ... from both the front end and the back end of the string.That makes the function very valuable, but the replacement gets a lot more complex!

Link to comment
Share on other sites

Ahhhhh ... I see from my Quickstart Guide that the RegEx "\s" is NOT just a space, but is "same as [\f\n\r\t\v]" (Formfeed, Newline Carriage Return, Tab, Vertical Tab).I can't find a code for just a Space ???

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...