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
votes1
answer65
viewsHow do I treat message with special characters
I am consuming a REST service that is returning the following message with special characters: "Espã Título Inválida" It is possible to treat this message?…
-
1
votes2
answers91
viewsHelp with String algorithm
I need to make a program in which the user types a string and a subletter, and inform how often this subletter occurs in the main string. Ex: Main chain: "banana" Subdivision: "na" Repetitions: 2.…
-
1
votes3
answers3324
viewsRemoving Accents and Transforming Spaces into PHP strokes
I updated my PHP and my following Script which I used to transform the text without accents, and the spaces in strokes (-) no longer works in PHP due to the ereg_replace is obsolete. <?php…
-
1
votes1
answer3104
viewsPython string corrupted with character
I have a program that creates for your running another program on the user’s computer. In a snippet, I define the directory to which the new program will be intended as diret = "C:\\Users\\" +…
-
1
votes2
answers98
viewsHow do you compare a string when it only has one space?
I would like to compare my variables, to validate a form: if ($nome or $categoria or $rua or $numero or $bairro or $abre or $fecha or $email or $telefone == " ") { echo"Tente novamente</b>,…
-
1
votes1
answer74
viewsQuery string paging with codeigniter
How do I search with pagination using query string in Codeigniter? I’m trying to search in the documentation but couldn’t find it! I have following scenario:…
-
1
votes1
answer5282
viewsPython - Sort string order by order of increasing number of letters
Having the following list: lista_nomes =['Manuel', 'Laura', 'Antonio', 'Jasmim', 'Maria', 'Silvia', 'Lu', 'Pancrácio', 'Diogo', 'Ricardo', 'Miguel', 'Andre'] And wanting to order it by order…
-
1
votes1
answer46
viewsPython - Complete list of each writer, along with the acronym of each person (first letter of name and surname)
Based on the list of writers described below, I have to manually create a list in which each element is a list of two elements, name and nickname. Here is the list: escritores = [['Pedro', 'Tamen'],…
-
1
votes2
answers1119
viewsHow to compare part of strings in C?
I can only compare two strings in full in C, but can I compare only part of a string? I wanted to develop a program that reads excerpts from a complaint and based on these excerpts give a response…
-
1
votes1
answer4739
viewsValidate Name and Surname in Javascript?
I have a form called 'Cad' of registration, my only validation that is missing is the name and surname, id, txtnome and txtsobrenome, I need a function that validates them as follows: Fields can…
-
1
votes1
answer82
viewshow to take a substring of size n that repeats
I have the following entry: aaisndiaunwioun test|test saiudb8iuyb aiwbu diby tab fiubaw palavragrande|palavragrande asibtiubi How to make the algorithm return test and palavragrande only if it’s…
-
1
votes2
answers126
viewsI want to search by name of any function from a search field
Guys... how can I make a system in which the input text gets a name from function.. then he searches his name internally with the name that is on string. guy... In HTML I do the following: <input…
-
1
votes2
answers100
viewsString compilation problem in C
I’m trying to compile this code into C: #include<stdio.h> #include<string.h> #define tam 100 typedef struct TipoAluno{ char nome[50]="A"; char curso[50]="B"; char cota[50]="C"; int…
-
1
votes2
answers193
viewsHow do I replace a specific part of a string?
I would like to know how to replace part of a string, but only part of order N. For example, replace the second (only) "and" of "electricity". Input: Electricity Output: Eltricidade Maybe it’s…
-
1
votes1
answer424
viewsDiscover string inside string without string library. h?
My function needs to check if one string is contained in another and speak where the first place where the letter was equal occurred, but is always returning the size of the first string What’s…
-
1
votes0
answers28
viewsI need an HDF5 Dataset Attribute to be a string
Good afternoon, I’m trying to create some attributes for my datasets, I was able to create the attributes but at the time of setting their values (strings) I’m not getting, I tried several different…
-
1
votes2
answers351
viewsProblem with string comparison
I need to compare if the name typed in textField is equal to the "root" user. At the time of comparing even typing root the Eclipse informs that it is invalid. Unfortunately I don’t understand the…
-
1
votes1
answer1084
viewsPlace string in a character array
I am learning character matrix and wanted to make a simple program in which I create a character matrix 200x100, put a string at position 0 and printed. This is part of a larger program that I’m…
-
1
votes1
answer1776
viewsC# - Remove QUOTES - Replace - Remove ASP Doubles
I have a variable (TEXT) that is a string, where its value is: "22/06/2018 00:00:00" How to make an Replace by removing its quotes?
-
1
votes1
answer2542
viewsAdding elements from a list to a dictionary in Python3
Good afternoon, I’m having trouble adding elements of a list to a dictionary. The list elements to put in the dictionary are: ['Joao', '83889023', 'Maria', '81944356', 'Marcos', '32258899', 'Ana',…
-
1
votes2
answers47
viewsProblem when replacing strings
Hi, I’m starting to create an equation interpreter, I want to replace the operators with words, but things aren’t going well... main.cpp #include <string> #include <iostream> #include…
-
1
votes1
answer131
viewsComparison in "if" does not fall where it should
What error in my code? Because regardless of the answer, the result is the else. #include <stdio.h> int main () { //variaveis char sigla[3]; //programa printf ("Entre com a sigla do seu…
-
1
votes1
answer178
viewsTake the result of an expression in c++
I’m almost done with my expression interpreter. But I have no idea how to do the most important part : The result I’d learn a lot from any idea. main.cpp #include <string> #include…
-
1
votes1
answer177
viewsSplit() problem in Mono
I’m using a platform that has multiple exercises, the Uri Online Judge, and it automatically fixes the output of the program, but it’s in Mono This is my code: string a = Console.ReadLine();…
-
1
votes4
answers360
viewsHow do I remove characters from a string to a certain extent? in PHP
I have the following code: $numeros = "142-22"; I just need "142" and I want to ignore the rest of "-22". How do I do it? Expected exit: $numeros = "142-22"; $num = "142"; Is there a function I can…
-
1
votes1
answer333
viewsThe Operator + is Undefined for the argument type(s) Charsequence, int
I’m trying to concatenate a text into CharSequence with int, but java warns that it is not possible to do this conversion by saying: The Operator + is Undefined for the argument type(s)…
-
1
votes2
answers229
viewsText mining with R (stringr)
I have a string lenght 15 and want to remove the first 70 charac. and the last 200 charac. each. I tried the following code to remove the beginnings and it didn’t work: texto2009a <- texto2009…
-
1
votes1
answer658
viewsIs the null character 0 automatically placed at the end of the string or not because I limited the scanf?
#include <stdio.h> #include <stdlib.h> int main(void) { char nome[20]; char sobrenome[20]; char nomeSobrenome[40]; printf("Insira seu nome e…
-
1
votes3
answers160
viewsUse string to reference variable
I wish to move on to the function execSQL the name of the variable I want to use in base.consulta() and from the string SQL, directly pass the variable to the function base.consulta(), that is, pass…
-
1
votes1
answer35
viewsProblem with a string attribute of an object
Hello! I’m having a problem with a member of the string type of my object. When I do the object.word assignment = "some word", the program even compiles and runs, but when I print the content, it…
-
1
votes1
answer78
viewsHow to concatenate values of different types into a string?
How do I concatenate all this string within a variable? Have some more elegant way to solve my problem? int num1 = 1; int num2 = 2; int num3 = 3; char simbol1 = '+'; char simbol2 = '-'; string…
-
1
votes1
answer65
viewsFile with strange characters
I have a string that receives a keyboard input value and a file that contains a string. What I need to do is compare the typed string with the file string and check if they are the same, but I went…
-
1
votes1
answer83
viewsComparison going wrong
I saw an example of comparison and I was in doubt of the reason for the operation. In the comparison below, he removes the text and <button> and compares in if for verification, whether it is…
-
1
votes1
answer98
viewsPrinting a 3-in-3 formatted sequence of numbers separated by dash
Let’s say I have the following entry String S = "00-44 48 5555 8361" and that I need to return this character string divided 3 by 3, separated by "-", as follows: Output: 004-448-555-583-61 The…
-
1
votes2
answers482
viewsError comparing strings
I need to make a program that takes a sentence, then a letter, and returns how many times the letter appears in the sentence. So I did this: import java.io.BufferedReader; import…
-
1
votes3
answers3324
viewsIgnore if it is uppercase and lowercase in the string
n1 = input('Qual é o seu bolo favorito?') if n1 = 'Bolo de Chocolate': print('teste123') If the user writes "Chocolate Cake" all in minuscule or all in uppercase, it will happen not to enter the if…
-
1
votes2
answers2874
viewsPython, Caesar Cipher, Strings
Hello, I would like to ask for some tips to improve the code, especially in the function 'geraMsgTraduzida', to make the code more beautiful if possible. def recebeModo(): """ Função que pergunta se…
-
1
votes1
answer63
viewsString marking and value return
Here is my program, I need to register up to 100 products, each product is available in 5 stores and I need to say the quantity sold of each product in each of the 5 stores. I will have a menu that…
-
1
votes1
answer1654
viewsHow to concatenate strings into a list?
If I have a list of string-like objects and want to concatenate all these items, how do I do that? For example: row1 = ['___', '___', '___'] I would like to print: '___|___|___' I managed to do so,…
-
1
votes1
answer97
viewsRemoving number by number from a sequence of numbers to compare them
My professor of algorithms and programming techniques passed an exercise in which a = "123567348" and from that I would say which numbers are even and which are prime. He said he would have to use…
-
1
votes3
answers124
viewsUse of "Contains" in search expression
I have a string _Users of the kind List, it contains several lines. Each line consists of an integer and a string separated by comma (in general it is only one string): ID (numbers only),name…
-
1
votes2
answers45
viewsSelection/Cleaning of information in a column
I have a database with thousands of rows, but in one of the columns the data is like this: XLOCAL Estirão do Equador, Rio Javari (04°27'S;71°30'W) Alto Rio Paru de Oeste, Posto Tiriós…
-
1
votes3
answers132
viewsError concatenating component value in query
As darlings in my C# Winforms project are being carried out through StringBuilder. It was suggested here in the O.R. query of Consulta.Append("Select * from...") for @"select * from..." for being…
-
1
votes1
answer103
viewsProblem with string storage and printing in C
I’m taking words from a text file, and when it comes to printing them it’s all right, except when I store them in a vector. If I store them in a vector, at the time of printing, before the words…
-
1
votes1
answer1326
viewsConcatenate a string with number in Typescript
I’m trying to add a 0 in the formatting of my date/month, but I’m not able to concatenate 0 with a string. I tried something like: var dd = dataAtual.getDate(); if (dd < 10) { dd = '0' + dd } I…
-
1
votes1
answer49
viewsException in thread "main" in String array
I would like to add the text inserted by the user in a vector position, but it is giving error... why? public static void main(String[] args) { int cont=0; String inserida =…
-
1
votes3
answers497
viewsConvert string into a list where each element in the list is 3 characters from my initial string
I wonder how I can turn one string on a list where each element of that list is a string with 3 characters from string original. Therefore if the string original was like this "AAGGGTTGG" I get a…
-
1
votes1
answer88
viewssplit does not return array with the string elements
I’m having trouble using the method split, that is not returning me the array with the elements of the string. public class Teste{ public static void main (String[] args){ String s = "0.101110";…
-
1
votes0
answers38
viewsData transmission with Arduino
I’m monitoring 3 analog inputs of one Arduino UNO and I don’t know if the way I’m sending data to serial is correct, because when I try to receive the information in another language(C#) does not…
-
1
votes1
answer107
viewsHow do I let a list with multiple indexes turn into a list with only one index in Python
How do I transform an element like this: lista = [testando, este, aplicativo] on a list like this: lista = [testando este aplicativo] Someone knows how to do this, and if it is possible to do this…