Most voted "indexof" questions
None
Learn more…17 questions
Sort by count of
-
7
votes6
answers47809
viewsHow to search for a particular object within an array?
I need to know if determined Array has a objeto with a certain value in its index. I tried to use indexOf, but I was unsuccessful. arr = []; arr.push({id: 1, nome: 'Wallace'}); arr.indexOf({id: 1});…
-
4
votes5
answers3692
viewscreate "contain" function that says if an array contains a certain element and returns true
I tried several ways with the indexOf (is a requirement of the issue use), but I’m having a lot of difficulty because I’m learning everything over the internet. The code I’m trying to use does the…
-
4
votes1
answer505
viewsSearch Matrix index from json value using the index
I have the following matrix: var usuarios = [ {nome: "João", id: 1}, {nome: "Maria", id: 2}, {nome: "José", id: 3}, {nome: "Ana", id: 4}, ]; I need to return the José user index. I tried using the…
-
4
votes5
answers815
viewsCheck if URL has string
hello, I am making a code using Typescript and I need to do a check to know which page the user is on, I am doing this check as follows: const url = window.location.href; if (url.indexOf("/Menu")) {…
-
2
votes1
answer61
viewsTake all elements that meet a condition
I have some Vector: public static Vector<Integer> id = new Vector<Integer>(); public static Vector<String> nome = new Vector<String>(); public static Vector<String>…
-
2
votes2
answers73
viewsHow can I get an Array’s Index number?
How can I acquire the number of elements that has the value of day of 5. This would have to return me another Array, for the manipulation to become more dynamic. This is the Array I have based on:…
-
1
votes1
answer442
viewsForm validation with index()
I know you can validate with HTML5 or CSS, but just out of curiosity: I found a code on the net that checks if the syntax of a typed email is correct: if(document.dados.email.value=="" ||…
-
1
votes1
answer955
viewsAngularjs indexof de Object
Every time I select a Bundle, add in an array, example: Items are some data I picked up, I just passed a few for testing var items = [755, 20, "E", 274] $scope.selectBundle = function(){ var info =…
-
1
votes3
answers843
viewsHow to extract a specific text from a string via Javascript
Question related to how to remove only part of the text that is after my tags p: and r: I am developing an application similar to chatbot simsimi and for test questions I am storing the questions…
-
1
votes1
answer162
viewsFilter JSON records by Javascript or PHP
I have a question about how to filter data when the customer fills in an input field. I am searching all server records (running PHP) through a jQuery JSON request and would like to know how to make…
-
1
votes1
answer179
viewsHow to search for a substring from an offset in Rust?
How to find the index of the beginning of a substring starting from a given index of string? In C++, for example, the method std::string::find accepts a offset or index where the search should…
-
1
votes1
answer82
viewshow to take a substring of size n that repeats
I have the following entry: aaisndiaunwioun test|test saiudb8iuyb aiwbu diby tab fiubaw palavragrande|palavragrande asibtiubi How to make the algorithm return test and palavragrande only if it’s…
-
0
votes1
answer141
viewsHow to check by the url if the page is the index
As I get through JS, if my url is the index? I have a code like this: window.onload = function () { url = window.location.href; if (url.match("/dashboard")) { [...] } } that checks if it is in the…
-
0
votes1
answer74
viewsSearch within two arrays
the case is the following. I have a script that I wanted to use and as in all questions "I suppose" I do not know how to do. The following I want to do an array data search with javascript "pq do…
-
0
votes1
answer249
viewsDoesn’t Index work on Arrays?
I have the following code that holds an array of 7 values, each for each day of the week. then I have to create a function that sums these 7 values (successfully concluded), tells what is the…
-
0
votes2
answers84
viewsindexof is not recognized inside the for
Hello I am trying to run this code so that it captures all the links of a page, it works all ok, the problem is that I want to find links that contain a certain word using index but is giving the…
-
-1
votes2
answers64
viewsIndex('+') works but Index('*') is not working?
The following code is a simple calculator that accepts two numbers and applies +, *, - or /. and the input of the signal + is working well: input = Console.ReadLine(); while (input.Contains("+")) {…