473,379 Members | 1,367 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,379 software developers and data experts.

using indexof to find a quote

how can i use the .indexof function to check if there is a quote in the string.

i can't seem to find the correct syntax for do this without an error occuring
Jul 23 '05 #1
6 12484
gl**********@bt.com (Glenn M) writes:
how can i use the .indexof function to check if there is a quote in
the string.


string.indexOf("'")

Are you using it inside an HTML event handler (onclick etc.)?
In that case, you need something like:

... onclick=" ... string.indexOf('\'') ... "

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
sorry i meant a double quote

whould it just be this

string.indexOf("\"")
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<65**********@hotpop.com>...
gl**********@bt.com (Glenn M) writes:
how can i use the .indexof function to check if there is a quote in
the string.


string.indexOf("'")

Are you using it inside an HTML event handler (onclick etc.)?
In that case, you need something like:

... onclick=" ... string.indexOf('\'') ... "

/L

Jul 23 '05 #3
gl**********@bt.com (Glenn M) writes:
sorry i meant a double quote

whould it just be this

string.indexOf("\"")


Try it! :)

/L 'and don't top post!'
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4
gl**********@bt.com (Glenn M) wrote in message news:<32**************************@posting.google. com>...
sorry i meant a double quote

whould it just be this

string.indexOf("\"")
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<65**********@hotpop.com>...
gl**********@bt.com (Glenn M) writes:
how can i use the .indexof function to check if there is a quote in
the string.


string.indexOf("'")

Are you using it inside an HTML event handler (onclick etc.)?
In that case, you need something like:

... onclick=" ... string.indexOf('\'') ... "

/L


How about just string.indexOf("'")
Jul 23 '05 #5
gl**********@bt.com (Glenn M) wrote in message news:<32**************************@posting.google. com>...
sorry i meant a double quote

whould it just be this

string.indexOf("\"")
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<65**********@hotpop.com>...
gl**********@bt.com (Glenn M) writes:
how can i use the .indexof function to check if there is a quote in
the string.


string.indexOf("'")

Are you using it inside an HTML event handler (onclick etc.)?
In that case, you need something like:

... onclick=" ... string.indexOf('\'') ... "

/L


Sorry, I meant string.indexOf ('"')
Jul 23 '05 #6
br*************@glic.com (bruce) writes:
> ... onclick=" ... string.indexOf('\'') ... "
Sorry, I meant string.indexOf ('"')


Inside a "-delimited intrinsic event, the " in '"' would still be used
to match the beginning ". The HTML parser doesn't know that the " is
inside single quotes in the Javascript, because it only looks at the
HTML.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #7

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

Similar topics

2
by: Ori :) | last post by:
I am writing an application to retrieve appointments from Outlook, I have the appointment items sorted by "Start" field and now I want to find the first record which's "Start" value is later than...
1
by: JeffOfJersey | last post by:
I'm trying to develop a dotnet application that uses the Word 11 com object. Whenever I try to use the find object I get a blow out. In the code fragment below executingthe ClearFormating method...
1
by: Chris Davoli | last post by:
I'm using IndexOf on my strings to find if there are certain words contained in a string. Well, this works fine except when I'm looking at an empty string, because the return value is zero based...
0
by: Rave | last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and...
2
by: suneet.taparia | last post by:
Hi, On IE7 I'm using a script: function saveValues() { var validateOK=true; if (typeof validate !='undefined') validateOK = validate(document.EditForm);
4
evilmonkey
by: evilmonkey | last post by:
Is there a way to use index of in java to pull the number of occurrences of every letter in a user defined sentence? I can brute force this but is there a faster more elegant way to achieve the same...
8
by: brekehan | last post by:
If I have a class MyClass { ...bunch o data and methods int x; }; and a stl container of MyClass objects Is there a way to use std::find to get all the elements whose member x
3
by: atrottier | last post by:
I am tring to import an Excel file directly to a table in Access 2003. The code runs but it locks up the app and I need to do a ctrl/alt/del to get out. Here is the code: Private Declare Function...
4
by: Anonymous | last post by:
I ahve a vector of doubles taht I need to extract values from. I was just about to use the STL find() algo, but I have a couple of questions: first: can you specify the tolerance threshold to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.