Questions tagged as 'array'

2
answers

Retrieve data in PHP within a text

I have the following text: $texto = "Olá {cliente}, seja bem vindo ao site {site}! Aqui você terá acesso as seguintes opções: {opcoes} Estes dados foram gerados automaticamente em {data} Pela empresa {empresa}"; Note that we have several...
asked by 26.08.2016 / 15:48
2
answers

How to find all the '' characters of a memo and store in a vector using delphi?

I have a edit field in Delphi and I need to go through it in search of the > character and store the position of all > characters in a vector. By doing this I can only get the position of the first character...
asked by 17.09.2018 / 14:46
1
answer

Merge two arrays

I have the arrays : $tamanho = ['P', 'M', 'G']; $quantidade = [1, 3, 5]; The end result would have to look like this: $final = [ ["tamanho" => 'P', "quantidade" => 1], ["tamanho" => 'M', "quantidade" =>...
asked by 28.02.2018 / 17:49
2
answers

Difference between arrays in Java

What's wrong with Android not setting the size of the array? I have seen in several places that this should be started with a default value. What is the internal difference of doing this: String[] array1 = new String[99]{}; Or this S...
asked by 24.03.2018 / 17:34
3
answers

How to check if a value is present inside an array?

$idofdb = "25"; $myArray = array(); foreach ( $fthi as $codigo ) { $myArray[] = $codigo['ImoCodigo']; } $checkValues = array_values($myArray); $checkString = implode(',', $checkValues); // 3,4,5,6,7,8,9,10,11,12,13,18,19,14,15,2 I'd like...
asked by 29.11.2015 / 21:41
2
answers

Sort array by key, being a string

I have a random array containing an alphanumeric sequence in its keys. Using the ksort function, I get the following result: array(22) { ["A1"]=> string(2) "A1" ["A10"]=> string(3) "A10" ["A11"]=> string(3) "A11" ["A12...
asked by 08.10.2015 / 16:32
1
answer

Assign pointer to the array inside a function

I'm trying to write a function that assigns an integer or list of integers to a pointer, depending on a parameter. But the assignment does not work inside it, just outside: void retorna_algo(int size, int* destino){ if (size == 1){ *dest...
asked by 11.02.2018 / 07:10
1
answer

R - how to sample pairs from a vector without repeating values?

I'm trying to create 100 pairs from a vector with 200 values. I have constructed a vector following a normal distribution as follows: vetor=rnorm(200,mean=30,sd=6) And now I want to extract 100 pairs of these values, but without repeating a...
asked by 10.02.2018 / 19:26
2
answers

Check string is contained in PHP Array

I have a function in cURL, its return is an indefinite amount of data, but its format is standard. Return: array(86) { [0]=> array(2) { ["value"]=> int(1) ["data"]=> string(27) "retor...
asked by 12.08.2017 / 23:59
1
answer

Why inArray does not detect uppercase?

I do not understand why when I search for PALAVRA inArray() jQuery does not find it. But if I look for palavra gives positive, when in array it is PALAVRA . The first test I expected positive does not work, why? I...
asked by 22.09.2014 / 20:48