indexOf « String « Javascript Data Type Q&A

Home
Javascript Data Type Q&A
1.Array
2.Clojure
3.date
4.decimal
5.function
6.global
7.loop
8.math
9.number
10.object
11.Regular Expression
12.scope
13.String
14.Var
15.variable
Javascript Data Type Q&A » String » indexOf 

1. In Javascript, what is the difference between indexOf() and search()?    stackoverflow.com

Being fairly new to Javascript, I'm unable to discern when to use each of these. Can anyone help clarify this for me?

2. JavaScript: string contains    stackoverflow.com

How can I check if one string contains another substring in JavaScript? Usually I would expect a String.contains() method, but there doesn't seem to be one. Edit: thanks for all the answers ...

3. Javascript, string: test string for presence of sub-string that includes an asterisk (*)    stackoverflow.com

I'm doing a pretty basic string matching test as follows:

if(msList.indexOf(textChoice) != -1)
This works well except that occasionally the sub-string I'm looking for (textChoice) ends with an asterisk. Then I end up ...

4. Search for all instances of a string inside a string    stackoverflow.com

Hello I am using indexOf method to search if a string is present inside another string. But I want to get all the locations of where string is? Is there any ...

5. How to strip the last part of a query string    stackoverflow.com

I need to isolate an id in a string using javascript. I've managed to get to the part where I get to the id but then I want to be able ...

6. Can't use .indexof on JSON string because it has no method 'indexof' javascript    stackoverflow.com

I have some JSON parsed, but I would like to take a link I get from the JSON, find an identifier in the link that makes it different (e.g. www.foo.com/IDENTIFIER/home), and ...

7. Referring URL Query String Parameters w/ Javascript    stackoverflow.com

I have a referring URL with a bunch of query string parameters. Here's my code so far:

var refURL=document.referrer;
var stock=refURL.substring(refURL.indexOf('?')+7, refURL.length);
This worked fine when I only had 1 query string parameter at ...

8. String.substring() or String.indexOf() different in IE/NS?    devnetwork.net

Well, I know very little (almost nothing) about regular expressions, which is why I don't use them I actually am trying to change the number of members, not guests. The string is something like # guests, # members, ... I need to check for GUESTS, though, because Members may be in another TD, causing it to use the wrong one, whereas ...

9. Split a String and then find the indexOf() multiple instances of a string    phpfreaks.com

Lets say I have a string var myString = "I was sitting at the green light thinking about the Green Hornet and thought about the greenish tints he had on the windows"; I need to split the string so its broken down by spaces like a CSV but just the space.. Then I need to find every instance of "green" but ...

10. A String.indexOf Gotcha?    sitepoint.com

more about same You stated "second example returned '2'; actually it's '3'", no I get 2 returned. 3 is not a valid index in the string "abc". lastIndexOf returns position (index) otherwise -1. If you do get 3, that is ahh, completely different problem. One would expect -1 return if the string being searched is zero length, and it does. The ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.