Most voted "string" questions
A string is a sequence of zero or more characters. It is commonly used to represent text or a sequence of bytes. When marking a question with this tag, also mark with the programming language to be used and the operation being attempted with the string.
Learn more…1,904 questions
Sort by count of
-
1
votes2
answers87
viewsConditional does not work as expected (related to ASCII table)
int tam, i; char msg[1000]; printf("Escreva a mensagem para ser criptografada: "); fgets(msg, sizeof(msg), stdin); tam = strlen(msg); for (i=0; i<tam; i++) { int aux; aux = msg[i]; if…
-
1
votes1
answer168
viewsString Split in C++
Folks I’m looking for a split on the following String in C++ [ { "Nome":"Gabriel", "idade": 23 } ] I’m doing it this way... I receive this json through a query get and storing in a string to power…
-
1
votes1
answer178
viewsString tools in ruby
Suppose the following string: "acc5???7???7ss?3rr1???5". How to check if the three question marks exist (exactly three) and if they are before or after numbers that add up to more than 10? I thought…
-
1
votes1
answer40
viewsaccent str_extract()
I need to do an analysis of books in Brazilian Portuguese. To organize a frequency list of words per book I am using the commands: GS.tidy <- GS %>% unnest_tokens(word, text) MM.tidy <- MM…
-
1
votes1
answer64
viewsHow to extract separate data from an out-of-format string
When extracting data from a pdf in R, extracting text line by line, I have the following situation. A string of interest that comes with three information separated by long spaces, as exemplified…
-
1
votes1
answer60
viewsStringtokenizer with String delimiter does not work
I have to wear one string tokenizer to share a string in Java. the code is like this: StringTokenizer st1 = new StringTokenizer(palavra, "--"); But when I enter the following string: 1 - -- * d 2…
-
1
votes0
answers63
viewsC++ How to take the string of the get method of a class x and concatenate with a class y string?
I am programming a code in Qt(C++) and I need to take values from the client class in the menu class (which I do not inherit from client) and concatenate into a string to print on the screen.…
-
1
votes2
answers213
viewsModify attributes of a label with a dynamic name
Example I did this because I am creating Controls and names dynamically, well. the problem is when I need to use or call these values. If I want to change the value of the control your text or value…
-
1
votes2
answers194
viewsHow to recover all occurrences [[xxx]] of a string in PHP?
I have a text with placeholders [[xx]], [[ccvf]], [[dfg]], etc. The text inside the placeholder is undetermined and the number of placeholders is variable. Then in the following text as I could have…
-
1
votes1
answer152
viewsWhat kind of data to store "2019-02-06T14:14:38+00:00"?
I am consuming an API that returns me a field date with that data: 2019-02-06T14:14:38+00:00 In my Mysql database I created a field timestamp, because he was the only close I could find. Well, I can…
-
1
votes2
answers262
viewsAdd value to a string list
I have a class, and in it I have a List<string> and I just create it to add the values elsewhere. But when I try to add a value, I get the following error: Nullreferenceexception: Object…
-
1
votes1
answer125
viewsNumberformatexception: Invalid int: "1" I CAN’T CONVERT STRING TO INTEGER
I have a String = "1" and I can’t convert it to int, I think it might have something to do with the way it was built, the class that reads the TXT file from the web and saves it in the database is…
-
1
votes2
answers245
viewsHow to remove a character-specific string from a Python string
I would like to know how I can remove a specific string string string. The string would be: \r\n. The texts are as follows:: 'Let the Bird of loudest lay r non the Sole Arabian Tree r nHerald Sad…
-
1
votes2
answers741
viewsHow do I put the value of a variable in a statement of another variable?
NomeDoProduto1 = str(input("Qual o seu primeiro produto? ")) NomeDoProduto2 = str(input("Qual o seu segundo produto? ")) NomeDoProduto3 = str(input("Qual o seu terceiro produto? ")) PrecoProduto1 =…
-
1
votes1
answer64
viewsRuby Language - Question about methods
I have a question about the Ruby language: class Carro attr_accessor :marca, :modelo, :cor # declaração do método dentro da classe def velocidade_maxima 250 end end carro = Carro.new puts "insira…
-
1
votes2
answers55
viewsCreate function to make calculations with a given operator using Javascript
I don’t know if it would work, or if it would be the best option, but I have a code that consists of the following: Situating that the value operacao come up with the argument +, and I want to use…
-
1
votes2
answers1808
viewsI cannot declare variables as a string in my C++ code
#include <iostream> #include <stdio.h> #include <string> void print(float arr[], string nome[], int x){ for (int i=0; i < x; i++){ printf("O aluno %s obteve media de %2.2f\n",…
-
1
votes1
answer626
viewsSort string containing letters and numbers
I have a list of objects that has an integer and a String (composed of letters and numbers). I would like to sort by that integer and as a second clause the alphabetical/numerical order of the…
-
1
votes1
answer160
viewsGet String (.net core for Jquery) value
I am developing a site with . net core and I am using Jquery. On the page Index.cshtml.cs I have a function that has the validations and I pass the messages (if it is ok, if there was an error),…
-
1
votes3
answers194
viewsTake what’s between the quotes
As I do to get only what is inside double quotes, the problem is the following, it is reading a file txt q on each line has a file path, as this below "Dinosfuls Mods.bmd" 45454545s 454545 How do I…
-
1
votes1
answer81
viewsCan’t find one string inside the other
When executing this code, and perform a test with: Entrada: analise padrão Mensagem: ana The sentence is not found inside the other. #include <stdio.h> #include <string.h> int main (){…
-
1
votes4
answers2153
viewsFunction to invert a string
I tried to do a function in order to invert a string but the program always returns (null). #include<stdio.h> #include<stdlib.h> #include<string.h> char reverse(char string[]) {…
-
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
answer168
viewsHow to find and change a pattern without replacing the other elements of a String with regex?
I have a template qualquer nome:{{UDA_numero qualquer}} that comes "loose" in a String. In that String, there can be "n" templates, words, numbers, etc. The goal is to catch this "any number" from…
-
1
votes2
answers622
viewsHow to Split Javascript using multiple tabs and without removing them?
I have the following Javascript code: if (v.includes("'!'")) var separators = ["\\\''", '\\\&', '\\\#', '\\\|']; else var separators = ["\\\''", '\\\'', '\\\&', '\\\#', '\\\|']; var…
-
1
votes1
answer436
viewsString error using the nextLine() method in Java
I have a problem with a simple java program. When I run and scan with String, it simply goes straight to the end of the program, but when I put char it does not pass and runs normally, even so I…
-
1
votes3
answers131
viewsBreak string every 4 positions - Python
Whereas we have the following string. codigo = '7777. 5698 897897. 236' After removal of spaces and . codigo_formatado = ''.join(codigo_de_barras.split()).replace(".", "") codigo_formatado Exit…
-
1
votes2
answers257
viewsHow to recover a specific chunk of text
I have a configuration file and need to get a specific chunk of a configuration, which would be the best way to do this? In the example below I need to take the section that starts in "config system…
-
1
votes1
answer108
viewsHow to convert Enum to int by filling with zero on the left?
Ladies and gentlemen, I have a question here of converting a enum in a string, but I need the conversion to be filled with zero to keep 2 digits. Example public enum System { Unknown = 0, Mirror =…
-
1
votes1
answer117
viewsC - Error reading a character using scanf(): scanf() command is "skipped"
I would like to know why my code does not accept reading characters, simply skip that step and perform the next. float altura, pesoIdeal = 0; char sexo; printf("Informe a sua altura : ");…
-
1
votes1
answer2019
viewsHow do I get the size of a Java String?
I’m creating a fake bank in java but I don’t know how to check if the password has 8 characters. public void criarSenha(){ String senhacriada = (JOptionPane.showInputDialog("Qual a senha ?"));…
-
1
votes2
answers379
viewsHow to search for partial text in a string list?
I have a list with several text elements, and I would like to know how I can find one of these elements by searching for a part of the text and not by the exact text. Example: Lista = ['Jorge…
-
1
votes1
answer324
viewsHow to insert single quotes inside simple html quotes
I need the placeholder for my input tag to be "Patient’s Name" and thanks to the script being used, I can’t double quote. I would like to know how I can insert a single quote within two single…
-
1
votes1
answer55
viewsCrash C program when running
Once I enter the variable data originalMoney the prompt crash. Follow the code (it’s incomplete, I only ran the test with the first case) #include <stdio.h> #include <stdlib.h> #include…
-
1
votes1
answer221
viewsChar array problem to find out if the input is vowel, consonant and uppercase or lowercase
I’m trying to get the user to type a symbol on input and the program recognizes whether the symbol typed was a vowel, an uppercase vowel, depending on the uppercase or other character. For this I am…
-
1
votes10
answers5627
viewsFunction that returns if one can go to the database with true/false?
EXERCISE: Set the function possibleIrAoBanco, take two parameters, the first is diaDaSemana (string) and the second horaAtual(number), the function must return true, only if the database is open.…
-
1
votes1
answer528
viewsHow to show/display a list of strings in Chained List?
Guys, I just started to learn Chained List in C language. Why didn’t my code display full string on the screen? It is displaying only integers or 1 character. The problem is in the display part (the…
-
1
votes3
answers168
viewsCompare python 'E' letter
I have this code that basically goes through the list new_users and check if there are already some users within current_users. When mine if converts the names of new_users for uppercase, lowercase,…
-
1
votes1
answer217
viewsHow to check if a string is None?
I have the following code: st = "" if None == st: print True else: print False There is a form of the string st be equal to None in order to type the value on the screen True?…
-
1
votes1
answer94
viewsWhy still use String instead of Stringbuilder in Java?
As many of you may already know, creating StringBuilder can greatly save the performance of our Java applications, as they are much faster than a String. This is due to the fact that the…
-
1
votes1
answer140
viewsHow to get the percentage of similarity between strings?
What is the best way to compare the level, or percentage of likeness between two strings using Javascript or Typescript? Example: string1 = "Este grupo é muito util para crescer profissionalmente e…
-
1
votes1
answer114
viewsHow to filter data by a text pattern in R
I have a database with data of Brazilian cities and states, I would like to filter only the states, all follow a pattern of having a "br_states_" before the name of the state. I tried to use the…
-
1
votes0
answers32
viewsUse variable value as JS parameter
I was doing some tests to train JS with HTML. Then I made a newsletter system, where a newsletter Object has the notes of some subjects, and by a select chose the subject and which bimonth wanted:…
-
1
votes1
answer54
viewsUnderstanding of string delimiter
char *strdelc(char *s, char ch) { int i,j; for(i=j=0; s[i]!='\0';i++) if(s[i]!=ch) s[j++]=s[i]; s[j]='\0'; return s; } This function aims to delete the character sent by the user, but I can’t…
-
1
votes1
answer215
viewsReplace letter by position
I’m doing a simple python hangman game and I’d like to know if you can replace it by the letter position. Type I want at position 1 '*' to be replaced by the letter I want. Code: palavra_secreta =…
-
1
votes1
answer58
viewsString Return
I’m trying to return a String format in a function, however error n occurs defined. func descreve(x, y int) string{ total := soma(x, y) return "%d + %d = %d", x, y, total } I don’t want to wear just…
-
1
votes2
answers120
viewsWhat is the correct place to store the validation messages in a . NET project?
I’m creating a relatively simple class, but I’ve included some validations in its properties. public class Sala : EntidadeBase { #region Enums public enum StatusSala { Disponivel, Reservada,…
-
1
votes1
answer188
viewsHow to convert a string to a direct number from the prompt?
I’m starting to learn JavaScript and I care about writing a code redundant/repetitive, has some more appropriate way of converting strings from prompt in numbers before inserting into array?…
-
1
votes2
answers328
viewsSwap the first characters of a String for another
I’m creating a 'fake bank' and wanted to make a method in which partially shows the password. I created an array called senha2 and the first 4 characters are shown as *, for example: senha :…
-
1
votes2
answers87
viewsHow to remove all elements from a list equal to a certain value
How to remove all values from a list that will have the same meaning for example: array = ['sim', 'sim', 'sim', 'sim', 'sim2', 'sim3', 'sim4'] Is there any way to make a looping loop as long as…