indexof Questions

13

Solved

I must be missing something very obvious, but I've searched all over and can't find this method.
Auroraauroral asked 10/2, 2011 at 20:36

4

Solved

How do I do the in-place equivalent of strstr() for a counted string (i.e. not null-terminated) in C?
Midyear asked 21/12, 2011 at 3:11

8

I have array with objects. Something Like this: var arr = new Array( {x:1, y:2}, {x:3, y:4} ); When I try: arr.indexOf({x:1, y:2}); It returns -1. If I have strings or numbers or other ty...
Speller asked 26/9, 2012 at 14:31

4

Solved

Below is my list of String. ["sunday", "monday", "tuesday", "wednesday", "thurs", "fri", "satur"] I want to do remove "da...
Fluidize asked 29/10, 2015 at 13:5

1

Solved

I've created a Swift array that contains collections of two instances of a custom data type: var myArray : [(MyDataType, MyDataType)]! When I want to add items to this array, it's trivial to do ...
Millur asked 16/4, 2018 at 23:4

8

I have a Class called AuctionItem. The AuctionItem Class has a method called getName() that returns a String. If I have an ArrayList of type AuctionItem, what is the best way to return the index of...
Provencal asked 6/5, 2013 at 7:7

7

Solved

I'm trying to use indexOf to find all occurrences of the characters 'the' in a sentence. For example, if the sentence were "The other day I went over there", it should return 3. I am able to do t...
Exemplum asked 27/7, 2016 at 18:5

2

Solved

String xStr = "hello/master/yoda"; String remv_last = xStr.substring(0, xStr.lastIndexOf("/")) System.out.println(remv_last); output hello/master My question is; how can I get this output, tha...
Mcvay asked 23/9, 2017 at 13:49

5

Solved

I had a question about the indexOf method. I want to find multiple cases of "X" in a string. Suppose my string is "x is x is x is x", I want to find x in all of its index positions. But how do you...
Newscast asked 14/2, 2011 at 1:5

3

Solved

Consider this code: public static void Main() { var item = new Item { Id = 1 }; IList list = new List<Item> { item }; IList array = new[] { item }; var newItem = new Item { Id = 1 }; ...
Jeanettajeanette asked 9/7, 2017 at 2:21

2

Solved

I have been using Array.indexOf in the Google Chrome console, I tried these codes [1,2,3].indexOf(3); [1,2,"3"].indexOf("3"); They all returned 2, but when I tried these codes [1,2,"3"].indexOf...
Drops asked 25/5, 2017 at 4:53

1

So I'm trying to make my program print out the indexes of each word and punctuation, when it occurs, from a text file. I have done that part. - But the problem is when I'm trying to recreate the or...
Firebrick asked 19/1, 2017 at 17:13

7

Solved

I have a string: string str = "hello"; And an array: string[] myarr = new string[] {"good", "Hello", "this", "new"}; I need to get the index of (...
Pretence asked 20/1, 2012 at 0:3

3

Solved

What's the best method to get the index of an object in an object array given multiple of it's properties? Imagine the following example array: var array = [ { color: 'red', shape: 'square', ...
Gangland asked 11/9, 2015 at 12:59

4

Solved

I need to input a two strings, with the first one being any word and the second string being a part of the previous string and i need to output the number of times string number two occurs. So for ...
Dys asked 7/9, 2012 at 19:29

6

Solved

Is there anyway to get indexOf like you would get in a string. output.add("1 2 3 4 5 6 7 8 9 10); String bigger[] = output.get(i).split(" "); int biggerWher = bigger.indexOf("10"); I wrote thi...
Thermo asked 6/6, 2011 at 8:44

3

Solved

Is it possible to use multiple arguments when determining indexOf on an array? I want to determine if my array contains any of three integers. Important to note at this stage that the array will o...
Fortunetelling asked 17/8, 2016 at 15:0

1

Solved

How can I check whether the page url contains a '#' character plus some random digits e.g. www.google.de/#1234 if( window.location.href.indexOf('#') > 0 ){ alert('true'); } Does indexOf...
Bookmobile asked 1/6, 2016 at 15:15

1

Solved

I have a byte array and wish to find the "occurrences" of some bytes. For example 00 69 73 6F 6D in a very large byte array (> 50/100 Megabytes) OR even better a reverse operation: Searching th...
Latreshia asked 28/5, 2016 at 15:10

2

Solved

I was wondering how the method indexOf of an ArrayList is implemented. In fact I have override the equals method like this: public class CustomObject { @Override public boolean equals(Object o) ...
Autocratic asked 24/5, 2016 at 13:37

1

Solved

I am trying to fetch the string after the third slash. But i don' know how to do it. I have used split but that's not what I want. for(String obj2: listKey.getCommonPrefixes()){ Map<String, St...
Guinevere asked 10/5, 2016 at 12:42

2

I'm new at JavaScript and there is one thing that bothers me. I have got a very simple code: var a = []; a[1] = 1; i = typeof(a[0]); index = a.indexOf(undefined); len = a.length; console.log(a)...
Creep asked 11/3, 2016 at 20:52

3

Solved

Below is what I have. var myString = "http://localhost:8888/www.smart-kw.com/"; alert(myString.indexOf("localhost")); This give me alert... however if I change var myString = "http://localhost:8...
Waterfront asked 2/12, 2012 at 12:56

6

Solved

How do I remove the brackets from the result while keeping the function a single line of code? day_list = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] def day_to...
Heterogenesis asked 22/2, 2016 at 15:2

7

Solved

The below function works fine on Opera, Firefox and Chrome. However, in IE8 it fails on the if ( allowed.indexOf(ext[1]) == -1) part. Does anyone know why? Is there any obvious mistake? function ...
Changeup asked 2/9, 2010 at 16:33

© 2022 - 2024 — McMap. All rights reserved.