473,378 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

remove quotes from string

hi,
i have a page that has a search box, when the user types something
into i'm able grab the data, but wanted to strip out all the quotes
(double and single) from it, what's the best way to do that?
basically i need to pass the search words to another page via the url,
but want to strip the quotes out first.

Thanks.

Jul 16 '07 #1
4 39518
On Jul 16, 4:36 pm, soni2...@yahoo.com wrote:
hi,
i have a page that has a search box, when the user types something
into i'm able grab the data, but wanted to strip out all the quotes
(double and single) from it, what's the best way to do that?
basically i need to pass the search words to another page via the url,
but want to strip the quotes out first.

Thanks.
Assuming you aren't passing the query to a static page, you need to do
this on the server side and it doesn't make sense to do it twice.

Jul 16 '07 #2
wrote on 16 jul 2007 in comp.lang.javascript:
i have a page that has a search box, when the user types something
into i'm able grab the data, but wanted to strip out all the quotes
(double and single) from it, what's the best way to do that?
basically i need to pass the search words to another page via the url,
but want to strip the quotes out first.
<script type='text/javascript'>
function stripIt(x){
x.value = x.value.replace(/['"]/g,'');
};
</script>

<input onblur='stripIt(this);'>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 16 '07 #3
On Jul 16, 5:30 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 16 jul 2007 in comp.lang.javascript:
i have a page that has a search box, when the user types something
into i'm able grab the data, but wanted to strip out all the quotes
(double and single) from it, what's the best way to do that?
basically i need to pass the search words to another page via the url,
but want to strip the quotes out first.

<script type='text/javascript'>
function stripIt(x){
x.value = x.value.replace(/['"]/g,'');};

</script>

<input onblur='stripIt(this);'>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Be cautious -- this is an excellent suggestion if there are no
contracted words being passed. For instance O'Neil or Mc'Mann would
not be treated well.

If it is not too much trouble, I suggest making sure the process that
is using " or ' as markers is refined rather that just attempting a
blanket removal.

I have always found taking those things out without a full
understanding of the process results in enormous bites out of my
behind.

Jul 16 '07 #4
On Jul 16, 6:16 pm, ft310 <tooh...@fullchannel.netwrote:
On Jul 16, 5:30 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:


wrote on 16 jul 2007 in comp.lang.javascript:
i have a page that has a search box, when the user types something
into i'm able grab the data, but wanted to strip out all the quotes
(double and single) from it, what's the best way to do that?
basically i need to pass the search words to another page via the url,
but want to strip the quotes out first.
<script type='text/javascript'>
function stripIt(x){
x.value = x.value.replace(/['"]/g,'');};
</script>
<input onblur='stripIt(this);'>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Be cautious -- this is an excellent suggestion if there are no
contracted words being passed. For instance O'Neil or Mc'Mann would
not be treated well.
They will be treated just fine. As the OP stated, he "wanted to strip
out all the quotes (double and single)."
>
If it is not too much trouble, I suggest making sure the process that
is using " or ' as markers is refined rather that just attempting a
blanket removal.

I have always found taking those things out without a full
understanding of the process results in enormous bites out of my
behind.- Hide quoted text -
I've found that posting without carefully reading the thread will have
the same effect.
Jul 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: soni29 | last post by:
hi, how can i remove a string from an existing string in javascript. i have a textbox in a form and want to make sure that when the user clicks a button that certain words are moved, like all...
0
by: TomislaW | last post by:
is it possible?
4
by: sherifffruitfly | last post by:
Hi all, I've got a csv file for numeric data, some of which are greater than 10^3. Some bright fellow trying to br helpful put US-standard commas in these numbers, and to maintain the correct...
10
by: teenIce | last post by:
Hi all, Does anyone have suggestion what can I do to remove some string from a string? Like this : Original : I have a cat. Remove : have Result : I a cat. Thanks in advance.
36
by: laredotornado | last post by:
Hi, I'm using PHP 5. I have an array of strings. What is the simplest way to remove the elements that are empty, i.e. where the expression "empty($elt)" returns true? Thanks, - Dave
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.