Posts by Douglas • 478 points
14 posts
-
1
votes2
answers467
views -
3
votes1
answer185
viewsA: Turn multidimensional array into one-dimensional VUE
You can use the method .map() to map the array data you want. const array = [{cod : '1', nome : 'S'},{cod : '2', nome : 'V'}]; const arrayCods = array.map(obj => { return obj.cod; });…
javascriptanswered Douglas 478 -
2
votes2
answers648
viewsA: Ignore scoring in a sequence of numbers using Regex with Java
Java implementation public static void main(String[] argvs) { // Com ponto String numeroSemPonto = extraiNumeracao("Fatura Cliente: 6.823935.10"); System.out.println(numeroSemPonto); // Com vírgula…
-
1
votes3
answers268
viewsA: Generate randomly in XXXX-0000 format
A functional approach would be like this: const geraAlpha = () => { return String.fromCharCode(65 + Math.floor(Math.random() * 26)) } const geraNumero = () => { return Math.floor(Math.random()…
javascriptanswered Douglas 478 -
1
votes1
answer37
viewsA: Data mask
You can use the method replace(). Example: String hora = "15:00"; String novaHora = hora.replace(":", "");
-
10
votes2
answers3616
viewsQ: What is the difference between a file . c and . cpp?
C and C++ are two different languages, however C++ is a "superset" or superconpin of the C language. So what is the difference between a file with the .c and .cpp?…
-
2
votes1
answer31
viewsQ: Class variable in Java have the same behavior as in Ruby?
In Ruby a class variable that is modified by an object ends up modifying the value of all other objects instead of making a copy of that value. This also occurs in Java?
-
2
votes4
answers25024
viewsA: Difference between If and Elif
If is for checking a condition and Elif is for checking another condition if the If condition is false. In the code there is not much difference, Elif will ensure that that condition is checked if…
-
1
votes4
answers1038
viewsA: How to create a regex to filter and delete files with a particular chunk in the name
Use that expression: (Copia - Copia) Parentheses define a group of characters to be 'captured' from the string. Sign in to this site http://regexr.com/3eoeg to see working.…
-
0
votes1
answer94
viewsA: Group continuous repeats with Mysql
Use COUNT(), DISTINCT and GROUP BY. Example: SELECT id, id_usuario, Data, COUNT(DISTINCT Text) AS Repeticao, Text from table WHERE id_usuario = 1 GROUP BY id ASC…
-
2
votes5
answers993
viewsA: What is the difference between referencing an attribute directly or by get/set
The attribute private does not let you access the variable or method in another class, except in the class itself, using the reserved word this. When you need to access in another class, you need to…
-
3
votes2
answers217
viewsA: Include a digit before the phone in the BD register
Try this code: UPDATE phones SET tel = REPLACE(tel, '(21)', '(21)9'); The REPLACE method replaces one string with another, in which case it will replace one part of the string with another that…
-
1
votes1
answer566
viewsA: Expression Calculator - Expression break problem
A colleague of mine made a calculator in Java and used a different way than yours. He used a method called "Eval" that turns a string into executable code for Javascript. I’ll show you an example:…
-
3
votes1
answer618
viewsA: Time interval in a while with javascript
Use the setInterval function. function whileComIntervalo () { while (cont != 100) { /* Resto do código */ } } function rotateText(id,dt) { /* Declaração de variáveis */…
javascriptanswered Douglas 478