Questions tagged as 'indexof'

5
answers

How do I search for a particular object within an array?

I need to know if given Array has objeto with a certain value in its index. I tried to use indexOf , but I was not successful. arr = []; arr.push({id: 1, nome: 'Wallace'}); arr.indexOf({id: 1}); // -1 How can I do t...
asked by 31.07.2015 / 16:05
1
answer

Search Index of the array from the json value using indexOf

I have the following array: var usuarios = [ {nome: "João", id: 1}, {nome: "Maria", id: 2}, {nome: "José", id: 3}, {nome: "Ana", id: 4}, ]; I need to return the user index José. I tried using indexOf as follows: var...
asked by 16.06.2016 / 02:12
1
answer

Catch 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> nascimento = new Vector<String>();...
asked by 15.06.2016 / 16:11
1
answer

Form Validation with indexOf ()

I know that you can validate with HTML5 or CSS, but it's just out of curiosity: I found a code on the net that verifies that the syntax of a typed email is correct: if(document.dados.email.value=="" || document.dados.email.value.indexOf('@') =...
asked by 05.11.2014 / 07:59
1
answer

AngularJs indexOf of Object

Every time I select a bundle, I add in an array, example: Items are some data that I get, I just passed a few to test var items = [755, 20, "E", 274] $scope.selectBundle = function(){ var info = { cod: items[3], bundl...
asked by 24.11.2014 / 20:26
1
answer

how to get 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 the before and after index of t...
asked by 03.05.2018 / 07:52
1
answer

Filtering JSON records by JavaScript or PHP

I have a question about how to do data filtering when the client fills an input field. I'm looking for all server logs (running PHP) through a jQuery JSON request and would like to know how to make a less "restrictive" JavaScript filter since th...
asked by 30.03.2018 / 01:55
3
answers

How to extract specific text from a string via JavaScript

Doubt related to how to remove only part of the text after my tags p: and r: I'm developing an application similar to chatbot simsimi and for testing purposes I'm storing the questions and answers in a var within the script. In...
asked by 29.04.2017 / 04:21
1
answer

IndexOf does not work in Arrays?

I have the following code that holds an array with 7 values, each for each day of the week. then I have to create a function that sums these 7 values (successfully completed), says what is the largest value of this Array (successfully completed)...
asked by 29.11.2017 / 19:23
1
answer

Search within two arrays

The case is the following. I have a script I wanted to use and as with all the questions "I suppose" I do not know how to do it. I am trying to do a search of array data with javascript "because they do not suggest other languages if your answer...
asked by 12.09.2017 / 19:58