Most voted "array" questions
An array (array, vector, or matrix) is an ordered data structure representing a collection of elements (values or variables), each identified by one or multiple indices.
Learn more…3,046 questions
Sort by count of
-
1
votes1
answer109
viewsHow can I subtract from a multi-position array with the same number in C?
The activity asks me to report a number of wagons and then asks me to assign a weight to each of them. I calculate the average of these weights and then subtract the average of the weights of each…
-
1
votes1
answer812
viewsIs it possible to have a split() with two or more conditions in Python?
Good afternoon staff, developing a code, I came across a question: I would like to realize a split() with n conditions? Or any efficient way to do? For example: I am requesting for a user to enter…
-
1
votes2
answers313
viewsProblems with array "Uncaught Referenceerror: Function is not defined"
Beauty guys? It happens the following, I created a tool to generate gambling (quina, mega sena and etc. link tool: generaterandom.000webhostapp.com) In the attached image we see the part where the…
-
1
votes1
answer47
viewsHow to place successive matrices in vector
I have the following matrices of 100 elements: int [][]matriz1 = { {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0},…
-
1
votes1
answer46
viewsCheck if a certain value is in the vector
I created the vector fragil that will accept various inputs from the user, inputs that will (or will not) be the position of other elements in another matrix. I used the following function to create…
-
1
votes1
answer100
viewsSimplify foreach to update a mongoDB doc that has nested objects and arrays
I want to update the value of the 'shouldSendAlert' key in a mongoDB document that is in the following structure: { "_id" : ObjectId("5c61c4db46d18e1092c5b024"), "service" : "SRVPVD", "menu" : [ {…
-
1
votes1
answer39
viewsWhat is the correct way to increment multiple inputs of a php array
Good morning friends , in my studies with arrays I find myself in a dilemma , I have a answer that returns me several products and in these products we have the category and other information in…
-
1
votes1
answer640
viewsChanging content of a Vue component based on the URL
I would like to know how to change the content of a component based on a parameter that is in the url of my site. I’m developing a portfolio and in it I created a file called Works.See. I don’t know…
-
1
votes2
answers836
viewsReturn data from a Json where there is a specific key in a PHP variable
I have a JSON with a standard structure. Within the structure I have the codTipo that would ruffle between To and B { "codSeq": "001224", "codTipo": "A", } { "codSeq": "001244", "codTipo": "A", } {…
-
1
votes2
answers177
viewsWhy is the code not running the for loop, even though the compiler is not showing an error?
I was doing an exercise on vectors, where the goal was to build a program that received a number n for input that would define the size of the vector, and then receive, also by input, others n…
-
1
votes1
answer435
viewsNgfor inside another Ngfor Angularx
I am trying to run a loop to show the values, respectively for each user, but with ngIf nothing appears, as I put here in the example, and without ngIf are shown the two values for the two users,…
-
1
votes2
answers92
viewsDoes Javascript have the equivalent of Python’s list comprehension?
I have the following code in Python: tag = 3 stack = [1,2,3,4,5,3,2,4,55,3,4,3] results = [i for i, x in enumerate(stack) if x == tag] This code will generate the following list: [2, 5, 9, 11]. And…
-
1
votes2
answers94
viewshow to handle JSON Array in PHP
I’m having difficulty dealing with this Array not being able to hit the paths in PHP. Below I list the Array { "Result": [ { "MatchKeys": "doc{57279000000}", "CreditData": [ { "Origin": "DATABANCO",…
-
1
votes1
answer64
viewsHelp with Array and operations
Array[1] previously set. The logic is to take the last array number, do the operation with the display value and return as the last array number. Example: Type 2 and press X, 2 * the last item of…
-
1
votes1
answer309
viewsCombine TIFF files on a multi-page TIFF C#
I’m making a program to convert and concatenate files. I wanted, after converting the PDF files into TIFF, to combine them into a single multi-page TIFF file. I’ve been looking for a long time and I…
-
1
votes1
answer117
viewsRemove object from array
I have the following array called listDeTipoAtendimento 0: {tipoAtendimento: "ESTUDANTE", tipoServico: "ESTUDANTE", atendente: "José da Silva"} 1: {tipoAtendimento: "Gestante", tipoServico: "teste…
-
1
votes1
answer111
viewsApplication error using vector java.lang.Nullpointerexception
Good morning. I’m trying to perform a proposed exercise in a Java course that I’m doing but I’m not getting it. This is a simple program that simulates the reservation of a hostel using vectors. I…
-
1
votes1
answer43
viewsHow to identify the number that was drawn
I would like to know how to obtain the values of the variables nipeSorteado and faceSorteada to compare with displayed output. The output of row 9 will display the values corresponding to the…
-
1
votes1
answer130
viewsRemove empty Request values from the form
I need to remove the values that from the first input are empty. $count = count($request->item); for($i=0; $i < $count; $i++) { if ($request->item[$i] === null) {…
-
1
votes2
answers46
viewsProblem for displaying the values of an Array on the front end
Guys, good night. It is difficult to display the values of an array on the front end. In the backend it appears but on the front it does not. My service task class where is the function that returns…
-
1
votes1
answer34
viewsRedeem value from a string in an array
How do I get a string inside an array like the one below: array(2) { ["data"]=> array(1) { ["charges"]=> array(1) { [0]=> array(8) { ["code"]=> int(433528162) ["reference"]=>…
-
1
votes1
answer51
viewsDelete key if all values are empty
I have an array of Javascript objects and wanted to check if certain keys/columns have the value "" (empty). If you delete this key from my Javascript object array, otherwise keep it the same.…
-
1
votes2
answers75
viewsHow to modify an object array through a condition?
I have the following object array: let items = [ { carro: { title: "Gol", description: "Gol quadrado", active: true, }, isVisible: true, }, { carro: { title: "Gol Filho", description: "Gol…
-
1
votes1
answer174
viewsHow to compare a zip code within an array with multiple ranges in PHP?
Eae personal! I’m needing a hint on how to filter a zip code into a list that will have multiple ranges, if (IF) the zip code is inside that list, run an HTML that has some strings in PHP. Basically…
-
1
votes1
answer129
views -
1
votes2
answers55
viewsError searching/searching for attribute in a vector
In this program with you insert the object peacefully in my vector with the method (Adder), but after I cannot fetch the string "plate" that the user typed... program always shows "Vehicle not found…
-
1
votes2
answers130
viewsTransform String into Array of Elements
I have looked at several examples on the NET but I am not able to solve this situation. I’d appreciate it if someone could help. I need to convert a string into an Array with elements, I will…
-
1
votes1
answer65
viewsOrganize a matrix
I have an array containing 16 objects, each object has the title, and definition attributes. I need to put inside each object in the definition attribute,. [{ titulo: universo, definicao:["(Física)…
-
1
votes2
answers352
viewsTaking an element inside an object
Hello, how do I get the "name" element, being that it is within "show" and the whole "show" is within "0"? (NOTE: If the nomenclature is wrong, I’m sorry, I’m beginner in JS) 0: score: 31.86105…
-
1
votes1
answer170
viewsC matrix showing large numbers and not typed
I’m having a problem in at least all my matrices made in class, I even caught a fixed problem of the internet and my matrix on PC is still showing random numbers. the code is as follows: : void main…
-
1
votes1
answer65
views -
1
votes1
answer959
viewsErrorexception : Illegal string offset
I have the following array. $polylines = [ 'latitude' = array(73.9289238, 83.928392832, 03.293892832), 'longitude' = array(-122.29839238, 21.928918291, 30.203929832) ]; I’m trying to execute the…
-
1
votes0
answers38
viewsTrying to program puzzle changing elements into equivalent positions of two error arrays
I’m trying to make a puzzle in which the image comes scrambled into pieces, and by clicking on two different pieces they change position, if the drawing is correct it goes to the next. But the…
-
1
votes2
answers146
viewsScroll through an array of dates to pick up the amount of monthly records from the last 12 months
I have an array with dates, each date means a new record in the users table, in this case, a new user account created. I need to go through this array to get the amount of accounts created over the…
-
1
votes1
answer77
viewsObject and Like Array Search in Javascript
I’m trying to get the value of a key inside an object inside an array, I can bring all the values of the key detyerminada, what I couldn’t get because I didn’t understand it properly was to bring…
-
1
votes1
answer61
viewsIs it possible for me to pass an array or POST as a parameter and save to the database without having to put in local variables?
I have a form with personal data of the client and I wanted to send this data to a class that has a method that saves the data in the database, but the form is very large and I wanted to send an…
-
1
votes3
answers385
viewsCalculate values in sub array [PHP]
I have an array with items, and each with a sub-array where we have the values to be added, I’m trying to make each sub-array have its sum returned, and display the following result.. //Esse seria a…
-
1
votes3
answers680
viewsTraversing array of objects
Good night. I have an array of an object and would like to take two values: object(OrgaosJurisdicionais)[17] protected 'data' => array (size=3) 'id' => string '3' (length=1) 'nome' =>…
-
1
votes1
answer33
viewsPass the value of a key when creating or after creating the array
I have the following JSON file: const animais = {"types":[ { "id":100196, "animal":"dog", "type":"adult", "tags":"AA 96 87" },{ "objid":100578, "animal":"cat", "type":"old", "tags":"T2 96 AB" },{…
-
1
votes2
answers110
viewsLoop Javascript for (...)
Talk, you guys, blz? Today I tried to make a Dropzone clone just to test the File and Filereader api. However, I think I’m missing some loop concept. According to the loop interaction, I take the…
-
1
votes1
answer2479
viewsGenerate even and odd random numbers with defined quantities
How to generate random numbers with Random and limiting the number of odd and odd pairs? Example: 50 numbers should be generated in total, being 20 pairs and 30 odd. public int GeraVetorParImpar() {…
-
1
votes2
answers267
viewsAdd values for same-day array
I have the following array: array (size=3) 10 => array (size=13) '11/06' => int 104 '18/06' => int 145 '25/06' => int 136 '02/07' => int 135 '09/07' => int 122 '16/07' => int…
-
1
votes2
answers834
viewsFind the highest vector value
A program that asks to find the largest number of an array, typing the amount of elements and until which element it will verify. However, in this program that I did it is not considering the first…
-
1
votes1
answer54
viewsIndex repeating when the page is exchanged in ngx pagination
my project is the following, is a site q uses the google Books api the problem is that when I add an object from the book array to the bookmark array, the index is reset when I change the page in…
-
1
votes2
answers2305
viewsReact.js creating several components with arrays
I’m trying to create several components <Pit /> however, one per result coming from the API, without excluding the previously created. The API returns an object with 2 arrays inside, the…
-
1
votes2
answers98
viewsJson for List C#
I have this Json (Json 1) { "2": { "Data": "28/10/2019 12:50:26", "Id": 2, "Id_usuario": 0, "Latitude": -2, "Longitude": -52, "Portas": 8, "Status": "CHEIO" }, "5": { "Data": "28/10/2019 12:39:33",…
-
1
votes1
answer54
viewsAt the last run of the repeat loop the entered value is assigned to my counter
I put a printf() to track what happened and everything was normal, until I type my last value and it is assigned to the counter quantN. The conditional even works when it is a negative value, it…
-
1
votes3
answers147
viewsDelete copied array item without deleting the item from its source - Vuejs
I would like to clone a list of numbers and be able to manipulate that cloned list without changing the source, but in the following situation when I delete the item from the cloned array it deletes…
-
1
votes1
answer848
viewsAdd an element that is not in the array
I’m new to C, I’ve been trying to find a way to do this program but always returns a result that I can’t understand when printing the array for visualization. Example of entered values:…
-
1
votes1
answer185
viewsDisplay array of "children" according to array of "parents" (JS)
Assuming I have the following JSON, and want to turn this information into HTML components (in my case, I’m using React), what should I do? [ { "id": 1, "nome": "Pai1", "filhos": [ { "id": 1,…