This is a discussion on "Stripping Characters out of Strings ?" within the JavaScript Forum section. This forum, and the thread "Stripping Characters out of Strings ? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Stripping Characters out of Strings ?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Stripping Characters out of Strings ?
Hi, i am new to JavaScript so please accept my apologies if this is a simple question.
I need to write a Function that will take a String (entered through a TextBox on an .asp Page by a User), and strip a range of characters (e.g. "," "/" "'" "|") out of it, and replace them with nothing. For example(s) :- 02/09/1967 should become 02091967 a,b should become ab Any help appreciated. Thanks, Mark. mark.davies@npower.com |
|
|
|
||||
|
Re: Stripping Characters out of Strings ?
Hi!
This code should serve you need pretty well..... just pass it the string to look in, what to look for, and what to replace it with.
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Re: Stripping Characters out of Strings ?
Thanks very much Rob, i'll give it a go.
|
|
|||
|
Re: Stripping Characters out of Strings ?
Whether you are doing this client side with JavaScript or server side with something like PHP, you might want to look at regular expressions.
They can do this and much, much more besides. The effort of getting to know how to use them will be well spent. |
![]() |
| Tags |
| stripping, characters, strings |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read First 3 characters and last 4 characters of string | JustinStudios | PHP Forum | 2 | Apr 4th, 2008 00:01 |
| cutting strings | alexgeek | PHP Forum | 5 | Aug 29th, 2007 17:12 |
| Javascript Strings Help | Sabin_33 | JavaScript Forum | 2 | Dec 21st, 2006 09:54 |
| Confused with strings... | ktsirig | Other Programming Languages | 1 | Jan 11th, 2006 18:02 |
| Quotes in strings | jakyra | Classic ASP | 5 | Sep 9th, 2003 15:10 |