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
-
2
votes4
answers483
viewsIs it possible to check the size of a string that is inside an array?
I have a array which is built on the results of chekbox selected... He returns with a var_dump: array(3) { [0]=> string(7) "BXT0022" [1]=> string(7) "BXT0010" [2]=> string(7) "BXT0024" } I…
-
2
votes1
answer176
viewsProfundidade Array
I have an a1 Array a1=[a2[a3[a4[]],a5]] I need to know the depth of the array now in this case is 3 because inside the a1 array has the a2 array and inside the a2 has the A3 and inside the A3 has…
-
2
votes2
answers3352
viewsReturn the values of an array after a given key
I have an array with about 100 positions this way: [ { "1":{ "id":1262, "nome":"Fulano", "sobrenome":"de Tal" } }, { "2":{ "id":1263, "nome":"Beltrano", "sobrenome":"da Silva" } }, ... ] How do I…
-
2
votes1
answer140
viewsXcode - Array position value is not displayed
I have an array with 30 positions and at each position of the array I have several objects like: Numprocesso, Nome, Idade, Sexo, Datanascimento. I would like to show all these objects from each…
-
2
votes1
answer3327
views -
2
votes2
answers3231
viewsSome method to save data from an Arraylist
First of all, some information: = .NET Framework 4.0 = Visual C# I’m simulating a database using a class specifically for this, using a List<string[]>, however, I would like to be able to…
-
2
votes2
answers87
viewsJavascript Array php values
In my database I have id , coluna1, coluna2 1 , 38.951399 , -76.958463 2 , 38.942855, -76.959149 I’m using php I need to transform this information into a Javascript array with the following…
-
2
votes2
answers813
viewsCreating a double array (not a multidimensional array)
I need to pass two values of the kind double for a AsyncTask in my application. I tried to define an array using the following code: double latitude = location.getLatitude(); double longitude =…
-
2
votes1
answer74
viewsCreate an array with dynamic variables
I needed to create dynamic variables and used this script: for($i=1;$i<=40;$i++){ ${"horario" . $i} = get_custom_field('horario'.$i); } It generates me the variables $schedule1, $schedule2, ...…
-
2
votes2
answers100
viewsHow to know if a Nsarray is empty (or void) using IF
I need to know if a Nsarray is empty or void using an if. Code: NSArray* array; if( array == nil) { // Fazer algo }
-
2
votes1
answer96
viewsHow do I return the number of lines that appear with a given start?
I wanted to open a document and have it return to me the last number of a line containing '>' as reference. This of all lines that have this '>'. or that he reads the amount of '>' that…
-
2
votes1
answer792
views -
2
votes2
answers517
viewsProblem loading file to memory
I am trying to load several files into memory (small file), but the problem is that when I try to load another file soon after, all the files get the same name as the last uploaded file. I am using…
-
2
votes1
answer655
viewsHow to generate data for Graphics
I am making a page that will have several types of graphics... But my base is coming by jQuery, Example: var wo = new Array(); var listItemEnumerator = this.customlist.getEnumerator(); while (…
-
2
votes1
answer11363
viewsConvert string to function array
I need a function that converts this string into an array as follows 3:2,4:1,5:1 //string array ( [3] = 2 [4] = 1 [5] = 1 )
-
2
votes2
answers227
viewsTraverse Array within a string
I’m creating a system that saves text and variables inside a file. txt and need to add inside this file the results of an array as well. Code: $produtoImpressao = $_SESSION['produtoImpressao'];…
-
2
votes1
answer966
viewsHelp with Java codemount from ArrayList (search, insert String)
Good evening, I have to develop a code, but I’m having some doubts, follow the code below: public class Aluno { String nome; int mat; Aluno(String nome, int mat) { this.nome = nome; this.mat = mat;…
-
2
votes2
answers348
viewsConvert JSON to UTF-8 on Android
I have a JSON Array and when it is displayed in a ListView on Android, appears with special characters: JSON generated by php: [{"id":"1","titulo":"X-Burg","descricao":"Hambúrguer,...","preco":"R$…
-
2
votes4
answers1688
viewsFill fields of a multidimensional array with null
I have this code who returns me this array and if you notice, you can see that you have empty fields. What I can increment in this code so that where the index is empty receives the value null?…
-
2
votes2
answers1523
viewsGroup keys from an array
How to group keys and identical values of an array? There may be N arrays inside the array, you cannot add equal keys. For example: [attributes] => Array ( [0] => Array ( [title] => Cor…
-
2
votes1
answer292
viewsVector in Java with fields in each cell
I’m doing a work in java and need to know how I do a structure similar to a Struct of C, where each cell of the vector has 3 fields, example vector[i]. age, vector[i].altura.. If someone can show me…
-
2
votes1
answer1981
viewsHow to customize the line of a Listview according to the value in Arrayadapter
Assuming I have an object called Item, and it has the text, id and validation property, in which case, text is a string, id is an integer, and validation is a boolean value. class Item { private int…
-
2
votes2
answers548
views -
2
votes1
answer4475
viewsHow to create an array with <input> data with checkbox checked?
With this script, written summarized because you know better than me. <?php $query = "select from table where status='0'"; $i=0; while (mysqli_fetch_array) echo '<input type="hidden" value="'…
-
2
votes1
answer158
viewsStore <Integer,Integer,Arraylist<Integer>> in a collection
What I intend to do is make a data association as follows: (<<Integer>, <Integer>, ArrayList<Integer>) I tried to create a…
-
2
votes2
answers353
viewsHow to increment variables
In the code below my variable y asks the user to enter values until y reaches 10, I store the variable x and currently the last information typed is stored (which shows at the end of the code) what…
-
2
votes2
answers426
viewsstr_replace using arrays
I want to blacken the terms searched in the results, but when I use the explode, and I try to use in str_replace, I get a array back. <?php $search_term = filter_var( $_GET['s'],…
-
2
votes2
answers4561
viewsExport data from an array to a table using VBA
In the Sheet1 i have a table only with the Header of each column but empty values, I run a VBA that creates an Array that has the same number of columns of the table. Is there any way to export all…
-
2
votes1
answer106
viewsSorting an Array
I have my class ItemList public class ItemListPropaganda { private int iconeRid; private String texto; private int valor; public ItemListPropaganda(String texto, int iconeRid, int valor) {…
-
2
votes1
answer1393
viewsVector struct and pointers
I have to pick up data (name and phone) of some people in a struct, then store them in an array, all this for a function/procedure. At the time of printing comes out some strange characters. I’m…
-
2
votes2
answers407
viewsOrganize folders, subfolders and acquisitions of an array?
Well, I have an array with the values: array("Pasta/Readme.txt", "Pasta/Subpasta/helloworld.mp3", "Pasta-2/screenshot.png"); How to return an array like this: array("Pasta" => array("Readme.txt",…
-
2
votes1
answer2885
viewsJava 8 - Collecting elements from a list
Good morning. I would like to collect specific elements from a list. I could do the Java 7 style, but I’m curious to know how I would do in the Java 8 style. For example: [[1, 2, 3], [1, 2, 3], [4,…
-
2
votes1
answer794
viewsHow to save byte array in PHP file?
I have a array of bytes which is an image that is saved in BD, which method to use to save on hard drive?
-
2
votes2
answers660
viewsPrint associative array element inside string without concatenation
I have to print out a tag HTML via a echo with the value of a array associative, however I can’t make it print to be concatenative use. Code .php (this way is not working, I believe by the quotes…
-
2
votes3
answers956
viewsVariable array assignment
There is a correct way to do this highlighted code snippet? $numeros = range(0, 9); shuffle($numeros); $id = array_slice($numeros, 1, 9); $mult =…
-
2
votes2
answers781
viewsGroup items by a field into different arrays
$resultado = $modelSga->getConsultaSga($ano, $mes, $unidade); foreach ($resultado as $res) { $idServico = $res->id_serv; $servico = array(); if($idServico != $idServicoAnterior) {…
-
2
votes3
answers806
viewsExchange array value when null
I have a Webservice in PHP that returns me a JSON with values from a mysql database. I need that, in an Array, whenever there is a null value (when = null), be replaced by white (= ""). I’m doing it…
-
2
votes1
answer715
viewsHow to find an item in a comma-separated field?
I have a field in a table with data separated by comma: id_regioes: 1,2,3,4,5,6. When I do the query "SELECT * FROM `tb_operadora` WHERE `id_regioes` = 1", or "= 6" returns ok, but not when it is in…
-
2
votes1
answer475
viewsPolymorphism with Arraylist
I have the Nterface below and I would like to know how to overlay the method by passing another object to List because I have 4 classes in my entity, for example the entity classes are cliente,…
-
2
votes2
answers186
viewsHow to make the id variable not repeat in the loop?
I’m trying to get one array associative as argument of this methods, actually receives a array in the first argument and a numerical value in the second. My question is how to make the variable $id…
-
2
votes1
answer3712
viewsHow to scroll through a 2-dimensional matrix in C and display?
In this code, I have a two-dimensional array(array), I started and I want to print with the printf, but I don’t know how: #include <stdio.h> #include <stdlib.h> int main() { int i; int…
-
2
votes2
answers67
viewsError displaying the sum of three arrays read
#include <stdio.h> #include <stdlib.h> int main() { int i, notas[5]; int soma = 0; for(i=0; i<3; i++) { printf("Digite os tres numeros:\n"); scanf("%d", ¬as[i]); } for(i=0;…
-
2
votes2
answers220
viewsIs there a function to reindexe a multidimensional array?
Guys, in need of help, I have a function that returns the following array: Array ( [0] => Array ( [0] => valor1 [2] => valor2 ) [1] => Array ( [0] => valor3 [1] => valor4 [3] =>…
-
2
votes2
answers2209
viewsTake larger existing value in a number array
By giving a function, I return an array with numerous random numbers. I need to get the largest number between this array, and for that I ended up finding the function Math.max(). The problem is…
-
2
votes1
answer488
viewsMerge Results of an Array
I have a PHP application that takes a Json file and creates a timed array: city | quarter | city | complement | addressee | state header('content-type: application/json; charset=utf-8'); $file =…
-
2
votes1
answer985
viewsSave information from a form
Hello, I’m developing an online proof system as the following image: The questions come straight from the database (MYSQL) and so mount the proof displaying question by question, when the user marks…
-
2
votes3
answers90
viewsConstant containing Array (matrix)
When I try to define a constant as an Array gives error. define('COLORS', ['red', 'blue', 'green']); Is there any way to define an Array in the value of a constant?…
-
2
votes2
answers155
viewsDifferences between arrays declarations
What’s the difference between declaring a matrix like this: 'C# string MinhaMatriz[] = [] 'VB Dim MinhaMatriz() As String = { } and so: 'C# string[] MinhaMatriz = [] 'VB Dim MinhaMatriz As String()…
-
2
votes1
answer131
viewsphp usort, sort table of brasilerão
Friends, I have an array with the Brasileirão table, it contains team name, wins, goal balance, pro goals, etc.. I would like to sort the array using Brasileirão criteria, points > wins > goal…
-
2
votes1
answer101
viewsHow to remove the red part of the figure?
require("setup_do_banco.php"); $colunas = $pdo->prepare("SELECT * FROM origem WHERE ativado = 1"); $colunas->execute(); while ( $coluna = $colunas->fetchAll(PDO::FETCH_ASSOC) ) {…