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
-
2
votes1
answer119
views -
2
votes2
answers3641
viewsInclude quotes in variable value String
I would like to know how to declare a variable of type String in which the value has quotes in Visual Basic . net? For example: Public frase As String = "E ele disse: -"Olá a todos!"" Is there any…
-
2
votes1
answer641
viewsInvert characters from a String
I have a code I made to invert a String, but it does not meet what I need. I need it to convert the order of the characters of each sentence. For example: He converts "Hi guys!" into "! laossep Io".…
-
2
votes1
answer163
viewsHow to remove a specific character from some specific strings within a Python list?
I have a list of examples: ['#[Header]', '#Application Name\tLCsolution', '#Version\t1.24'] I would like to know how to remove a specific character, such as the # of all elements of the list, or, if…
-
2
votes1
answer1711
viewsSimple text editor in C
I have the following exercise proposed: Make a program that mimics a text editor. Initially you will read the data typed by the user (lines of text) and create a vector in memory where the texts…
-
2
votes1
answer1360
viewsTurn lowercase into string
I need to do a function that takes two strings, and switch places both. But if you have a capital letter in the first one, at the time of converting you need to go to lowercase. I tried to do, only…
-
2
votes2
answers120
viewsHow to format strings and store them in a dynamic vector
In several parts of my code I need to use bash commands to run programs on Ubuntu. To do this, format the command using sprintf and then run with the system function. Ex: sprintf(sprintfoutput,…
-
2
votes1
answer665
viewsConvert File string to Float
The program below should take the data written in a file . txt, show on screen and do the general average calculation. the data in . txt are being saved in the following format: Student: Bruno First…
-
2
votes2
answers2020
viewsSplit String with . Split - C#
Good morning, everyone, I am trying to pick up a specific part of a string in Visual Studio, in which case the string in question is a directory path: "C: Users User File-2018.txt" I would like to…
-
2
votes0
answers40
viewsDifference between String and String in C#
Following example: String teste = "teste"; string teste2 = "teste2"; What is the guideline for using each of the forms?
-
2
votes1
answer75
views -
2
votes2
answers1433
viewsInvert "string"
I have the following function: void InverterString(char *str1){ char aux[strlen(str1)]; for (int c=0; c<5; c++) aux[c] = str1[4 - c]; printf("A string1 invertida fica: %s", aux); } However, it…
-
2
votes1
answer65
viewsHow to get a value using interpolation?
I am trying to recover a class value using interpolation. Using Console.WriteLine($"Meu Nome é, {pessoa.Nome}");, I get the value of the form I want, but in my case the string will come from a…
-
2
votes2
answers141
viewsIs it recommended to use memset before strncpy?
Usually when we want to copy the contents of a particular string into another string we can use the functions strncat or strncpy. Using strncat The use of strncat to copy strings is kind of "wrong"…
-
2
votes1
answer174
viewsString search with character "|"
I need to perform a query in a txt file in Python, but I have 2 problems due to interpretation of special characters. When I insert | or \ the result is replaced: the | is addressed as white space…
-
2
votes2
answers181
viewsValues returned in comparison of strings in C
I was reading about some of the functions of header string.h in http://www.cplusplus.com/reference/cstring/ and I came across some comparison functions between strings (useful after all), such as,…
-
2
votes0
answers41
views'str' Object has no attribute biopython
I’m working on the biopython. Request input of an input(): enz_name1 = input('ENZYME 1 NAME: ') enz_name2 = input('ENZYME 2 NAME: ') However, when I want to use input() to use . catalyse in this…
-
2
votes2
answers301
viewsWhen should I use a string object and a literal string?
Reading an article I find the following excerpt: You can call any of the methods of the string object in a literal string - Javascript automatically converts the literal string for a temporary…
-
2
votes2
answers684
viewsHow to detect line breaking in Python input?
I need to read test cases of the following format: 3 1 2 3 4 52 2 1 87 10 51 32 1 36 21 34 32 12 34 45 200 (... 200 numeros separados por espaço) and so on, where the first number indicates the…
-
2
votes1
answer134
viewsRecursion Doubt with String in Java
I’m trying to solve the following exercise: A string collection S is recursively defined by: 'a' and 'b' belong to S; if X belongs to S, then Xb also belongs to S; Write a procedure that implements…
-
2
votes3
answers155
viewsSimple question about the title() command
if I put for example the name: Roberto justo da silva using the title he gets like this: Roberto Justo Da Silva How do I make the command title do not change the word 'da' to look like this: Roberto…
-
2
votes1
answer3485
viewsChange varchar field yyyy-mm-dd hh:mm:ss to data dd/mm/yyyy in SQL Server
Guys, I’m extracting the data from a satisfaction survey log, and I’m trying to create a column with the date format, so I can group the days and months into an Excel dynamic table. For more…
-
2
votes4
answers567
viewsHow to know if the first character of a string is capitalized?
I need to know if the first character of a string is capitalized and does not let the program follow. How to do? Console.Write("Digite o nome do " + i + "º rei: " ); kings[i] = Console.ReadLine();…
-
2
votes2
answers165
viewsHow to take the first character of a String and make it uppercase by storing it in a variable?
String user,newUser,newPassword, password, resposta, user1,pass1; user = "admin"; password = "123"; Console.WriteLine("LOGIN\n"); body: Console.WriteLine("Ja possui…
-
2
votes2
answers711
viewsSplit and rsplit methods, python
I made this little program to try to simulate the methods 'split' and 'rsplit' of Python, but when I run it does not print the last sentence of the string. For example, if in the string I type 'pao…
-
2
votes1
answer101
viewsSegmentation Fault function that changes the values of 2 strings
The following function changes (or at least should) the content of two strings void trocar(char *a, char *b){ char *novo = (char *) malloc(sizeof(char) * 10); strcpy(novo, a); strcpy(a, b);…
-
2
votes2
answers399
viewsIs there a method in Python similar to x.find(string), but which returns all occurrences?
For example, I have a string with several occurrences of a: a = 'abcdefhanmakaoa' If I use the method find, I can only find the index of the first occurrence. There is some native method/function…
-
2
votes1
answer548
viewsStack Exercise - String with Trash
Write an algorithm, using a Stack, that inverts the letters of each word of a text finished by a dot (.) preserving the order of words. By example, given the text: THIS EXERCISE IS VERY EASY. The…
-
2
votes3
answers551
viewsConvert string to integer positions
Console.Write("Digite um numero de 4 digitos: "); string numero = Convert.ToString(Console.ReadLine()); int soma = 0; for(int i = 0; i < numero.Length; i++) { soma += Convert.ToInt32(numero[i]);…
-
2
votes2
answers1472
viewsSwap letter by number in C
I’m trying to program a phone algorithm with the old keys where the user will enter the letters as input and output will return me in the form of numbers. Note an example below: Input: Hello-World…
-
2
votes2
answers224
viewsDelete string until it reaches the character and ":"
How to delete a part of the string until it reaches the ":" character. I was able to delete ":" using the code below: Example String: uma_phrase_random: Ronison string url = empresaweb2; string…
-
2
votes1
answer64
viewsDifference of use of immutable object in method argument or outside it
If I have the following String of which it was created: String s1 = "Primeira String"; When using the method: s1.toUpperCase(); nothing happens because an instance has been created and has not been…
-
2
votes3
answers1008
viewsHow to put a link inside a String?
How do I place a link inside a string? var results = [ { text: "Quero colocar um link aqui exemplo <a href="#"> Link </a>"; },
-
2
votes1
answer75
viewsHow to make a string to be "transformed into a number"
I have an exercise to make the user type a word and it is transformed by its corresponding numbers from the ASCII table. EXAMPLE: sara would print 115 97 114 97 that’s the code: OBS: I put a fixed…
-
2
votes4
answers2332
viewsPrint String vertically in Python
It’s a string-only exercise, I haven’t gotten to the list part yet What my mistake ? print("-"*30) nome = str(input("Digite seu nome: ")) cont = '0' while cont < nome: c = int(cont)…
-
2
votes0
answers321
viewsRemove accent from a string in C language
I’ve got a college paper on Threads and competition control (Openmp) in C, which is giving me a bit of a headache. The job is to take a text from any file and separate it between Threads producers…
-
2
votes1
answer123
viewsHow to compare responses and templates where each is a PHP string
I have 2 PHP strings that are the student’s responses and feedback. I need to compare them and show the result in a table: $respostas='1;A|2;B|3;C'; $gabaritos='1;A|2;B|3;D'; I need him to generate…
-
2
votes3
answers6345
viewsHow to turn upper-case and lower-case letters into upper-case letters in Python?
What was the name of the Python method that turns upper-case and lower-case letters into upper-case letters in the same string? For example: texto = "AquI TeM umA StrinG" saída = "aQUi tEm UMa…
-
2
votes2
answers1154
viewsWhat type of variable allocates less memory, integer or string?
Imagining the situation I’m taking from the database a field number, which represents the client’s code. This value tends to be between 1 to 50000. I must for this case save as string or how integer…
-
2
votes1
answer104
viewsFunction . split() buging the output of the string in python2, how to solve?
Hello, I’m new to Python and my question may be obvious, but I would like to better understand the workings of the string; I am facing an error of execution of a function that I created and do not…
-
2
votes1
answer8331
viewsRemoving all spaces from a string using Javascript
I wonder if you have a way to remove all whitespace in a text using Javascript.
-
2
votes1
answer105
viewsString comparison gone wrong - Python
I have this function that checks if the code I typed is in the code list, but even though the code is in the list it does not enter if and returns false. I can’t understand why it doesn’t work.…
-
2
votes2
answers432
viewsHow to compare two identical`strings, but different encoded strings?
I want to compare two strings, which are equal but have different encoding. G%C3%A9rard Depardieu and Gérard Depardieu I need to make several comparisons in two lists, but I came across this. The…
-
2
votes1
answer58
viewsWhy does the conversion take place in the wrong way?
When performing the conversion of a number I need to format it, and unfortunately it is not coming out the way I need it. I need to format a number of 11 digits in CPF, but when putting the…
-
2
votes1
answer172
viewsLoop Replace all string characters by python list character
What I want to do is take a string and for each character of the string walk type 3 positions back in the alphabet and replace in the string or create a new string Ex string = 'abcd' walking 3…
-
2
votes1
answer41
viewsWhy did I have to add global research to this replace?
I am trying to remove this string from my string ​. var mypage = '<div pr-compile-html="d.article.body" id="article-body" pr-highlight="" pr-highlight-tooltip="#highlight-tooltip"…
-
2
votes2
answers353
viewsProblem to print on screen a string with accent
I would like a help, because when the user type his name with accent, when printing on the screen the name, appears disfigured. #include <stdio.h> #include <stdlib.h> #include…
-
2
votes2
answers78
viewsCondition does not enter as entered
No matter what I type is falling on the first if, if I type m, M or even 10 will fall in the first if. I want that if the user type f or F appears feminine and the same goes for M or m. Letra =…
-
2
votes7
answers4295
viewsWhat does it mean Does the solution make comparisons against strings in the following code? JS
The statement of the financial year is: Declare the dayFew you receive a "Sunday" string. Then implement a conditional using if that compares diaDemana is equal to "Sunday", if true print a string…
-
2
votes1
answer1999
viewsSyntaxerror: invalid syntax, what happened?
I am using Python 3.7.4, I tried to write several different ways and nothing worked. character_name = "Johnny" character_age = "64" print(+character_name "is cool.") print("And he is " character_age…