Posts by Anderson F. Viana • 111 points
8 posts
-
0
votes2
answers115
viewsA: Problem capturing the title of a URL using regular expression
To the . marry \n it is necessary to add (?s) à regex. package main import ( "fmt" "io/ioutil" "net/http" "regexp" "strings" ) func tituloURL(urls ...string) <-chan string { ch := make(chan…
-
1
votes2
answers482
viewsA: Error comparing strings
The method charAt returns the primitive type char, so it cannot be referenced. You can replace the snippet: if(frase.charAt(i).equals(letra)) { contador++; } for: if(frase.charAt(i) ==…
-
1
votes2
answers224
viewsA: Why do you use extern?
The use of the word extern is used when you want to use a shared variable in several files. A well-known use is stdin. If you put the no extern in the archive .h an error may occur when link-editing…
-
0
votes1
answer50
viewsA: JS moving in variable that doesn’t have to move
PosicoesOriginal and espelhoPosicoes refer to the same object, that is, when espelhoPosicoes changes the object, changes are reflected in PosicoesOriginal. If it is necessary to change the value of…
-
3
votes2
answers359
viewsA: Relate structs in C
Do with chained or vector list. Example: struct animal{ int codigo; char nome[200]; }TAnimal; struct jogador{ int codigo; char nome[200]; // o numero de animais int numeroDeAnimais; // as…
canswered Anderson F. Viana 111 -
1
votes2
answers66
viewsA: List removal
Missing update the head with the value NULL, is this way: void excam(lcam **cabeca) { setlocale(LC_ALL, "Portuguese"); lcam *noatual; noatual = *cabeca; if(noatual == NULL) { printf("Lista Vazia!");…
-
0
votes6
answers615
viewsA: Regular Expressions with Java Patterns
Try the pattern ^((.*[^a])?[a]{2}[b]{2,}.*)$. Explanation: - The ^ at the beginning and the $ at the end of the force the full recognition of the string. - The pattern (.*[^a]) avoids grouping more…
-
2
votes3
answers122
viewsA: Why does the code print 0 instead of 5?
The code b=b; has no effect on the method public void setB(int b) class B. When a parameter exists with the same field name (field) it is necessary to use the this to access the field and the reason…