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
-
3
votes1
answer109
viewsMemory allocation and wiping in C - how much should I worry about?
I’m learning C from the book "Use Your Head! C" (damn me). Given a lesson, I need to create a struct calling for "island" with the following code: typedef struct island { const char *name; const…
-
3
votes3
answers1653
viewsArraylist for String with split
I’m trying to break the following ArrayList with a String: ArrayList<Funcionario> funcionarios = new ArrayList(); But when I instate the object, I add the values inside through my method and…
-
3
votes1
answer1405
viewsRunning text as code in VBA
The code below calculates the formula contained in the variable Text (String): Private Sub CalculeFormulaNoTexto() Dim Texto As String Texto = "= 90 / 3 + 7 + COS(0) + 1/7" ' A variável Texto recebe…
-
3
votes3
answers66
viewsHow to use a string from the database
I have the following string saved in the database.…
-
3
votes1
answer114
viewsFind the index of all occurrences in a jquery string
How to find the index of all occurrences of a string within another string with jquery? Example: String all "three sad tigers for three wheat dishes, three wheat dishes for three sad tigers." String…
-
3
votes1
answer363
viewsInsert current date in a field
I’m using dataAdapters do . Net to create a project as a BD learning base with C#. I chose an easier path that would be to work most of the time in design mode through the Datasets. The battle I…
-
3
votes1
answer61
viewsDoubt with Regex
Good night. I need a regular expression that can capture the numbers/expressions before and after a certain character, like this one ^. For example, in the string below I need her to return me (5 *…
-
3
votes1
answer2557
viewsRemove spaces via Update
I have a field called titulo, on the table noticias. Unfortunately, due to forgetting the command trim PHP, has several titles with space at the beginning and end of string. How can via SQL (Mysql)…
-
3
votes1
answer4507
views"error: 'string' does not name a type" when declaring strings
Follows the code class Nome { public: Nome(string nome, string sobreNome); void exibirNome(); virtual ~Nome(); protected: private: string nome; string sobreNome; }; Error error: expected ')' before…
-
3
votes1
answer597
viewsJava String byte array with negative numbers
I’m having trouble figuring out the encoding of a string. The entrance is: São Paulo The original reading of this content is not my job, because the text goes through a Lua wrapper for Java. On my…
-
3
votes3
answers1794
viewsJava - Palindromic string inversion
I’m trying to do an exercise where I need to invert a word, phrase or number and check if it’s palindromic. For words and numbers, it is already working, but for sentences it gives errors depending…
-
3
votes4
answers312
viewsCount distinct names saved in txt
I have a txt file with a line-separated user name below: diego sergio antonio maria diego antonio Notice that names can repeat, and I would like to count and list only the distinct names. I did this…
-
3
votes1
answer64
viewsWould an alphabetical sequence counter be possible?
I’m making a code in Pascal where one of my arrays has alphabet values (from A to Z) for a personal project of the type Questions and Answers/ Meaning A to Z: aux[1]:= 'a'; aux[2]:= 'b'; aux[3]:=…
-
3
votes2
answers8240
viewsDouble quote character removal "
I have a code that reads a CSV and saves the information in the database, but I ended up getting a CSV "different" than what I’m used to reading. This CSV come with double quotes in the information.…
-
3
votes1
answer86
viewsString truncate when performing append
The code below serializes a JSON list and gives a append the variable result. However, from a certain amount of records (350), the text contained in result has a modified part for "..." . I…
-
3
votes2
answers488
viewsConvert string array to string in VB
I need to use SPLIT in multiple data, but I need to convert the string to string array for this. I’m putting String() to receive the string array variable, but VS keeps telling me that one dimension…
-
3
votes3
answers397
viewsHow to reverse date
I’m trying to invert a date variable that displays the results like this: 2016/05/20 But I want a php function that displays like this: 20/05/2016 How to do this?…
-
3
votes1
answer1231
viewsSorting of string and number vectors
I’m having a problem with a college exercise. Basically it’s a shop system, where I come in with the amount of stores, the amount of products, the name of the products, and the amount of products in…
-
3
votes1
answer852
viewsHow to change null field to not return anything?
In a query has many fields not being filled in, would like to exchange the null that is being printed so that nothing appears in the print.
-
3
votes2
answers719
viewsKeyword in String C language
I’m trying to make a program in C to find a word in a string vector, returning the position of the word and when not finding returning -1. I’m having trouble with substring, type my program…
-
3
votes1
answer27947
viewsFormat CPF or CNPJ field using Regex
I would like a regular expression (REGEX) to format the CPF or CNPJ field This is the code I’ve come up with so far: String cpf ="09551130401"; cpf =…
-
3
votes1
answer1045
viewsURI Online Judge - 1168 - Java
I am trying to solve the 1168 URI problem. However, I am not getting the number of Leds needed to mount a number. Specifically, my variable is valorLed is always resulting in zero. Can you help me?…
-
3
votes2
answers407
viewsCompletion of mandatory fields
How do I force at least one of the two fields to be mandatory (is filled)? For example, the fields Celular and Telefone cannot be saved empty, only one of them. My code: //.. } else ((txtNome.Text…
-
3
votes3
answers134
viewsUnderstand "," as "." when formatting
My Visual Studio is getting a little wrong what I type (console): using System; namespace Uri_CSharp { class URI { static void Main(string[] args) { double raio = double.Parse(Console.ReadLine()),…
-
3
votes1
answer400
viewsHow to convert Ansistring to Char in C++ Builder?
I need to pick a file txt through the OpenDialog, to open through fopen. The problem I’m found is in the conversion. The function fopen has as a parameter a const char, already opendialog returns…
-
3
votes1
answer514
views"toString()" returning Null when it should not
I have the class Aluno. public class Aluno { private String nome; @Override public String toString() { return this.nome; } //metodos getters e setters } Class Vetor public class Vetor { private…
-
3
votes2
answers79
viewsError in program execution involving pointers
I was doing a C program that read string1 and deleted the first string2 occurrence. In string1:"Mouse Chewed Clothes" if I put "Ra" in string2, the program deletes correctly, without errors. But if…
-
3
votes2
answers2767
viewsDetermining a string within a C switch
I have doubts about how to define a string within a switch in C, without having to make a table of constants for this. The variable nome_lanche is the type char, but this with the number of…
-
3
votes1
answer108
viewsText Cleaning and Standardization
I have an Excel table already in R with two columns (code and company name) and 22 thousand rows. The names have been filled freely, so the same name is written in different forms, abbreviated and…
-
3
votes1
answer201
viewsProblem with strlen()
Why is this code printing an extra number when I initialized the variable as 0? #include <stdio.h> #include <string.h> int main ( void ) { char texto[50]; int cont = 0; printf("\nInforme…
-
3
votes2
answers82
viewsConversion of byte array to string when compiling revealing the string in C compiled code
I am using the function below to make the conversion of byte array for a string, but when analyzing the compiled code I note that the string is clearly shown (using an Hex editor), what I do not…
-
3
votes1
answer36
viewsWhy does "is" not work when comparing the replace of a string?
I tried to do in CLI Python 2.7.6 the following command: 'foo bar'.replace(" ", "") is 'foobar' But returned False Despite 'foo bar'.replace(" ", "") return 'foobar' Does anyone have any logical…
-
3
votes3
answers318
viewsChange the format of a date(time) in a String
I have two strings that receive hours, in this case, Arrivaltime and Departuretime. The format that comes is HH:MM:SS. I would like to format this string to HH:MM how can I do this? Insert this text…
-
3
votes4
answers2433
viewsCount the number of times a character appears in a string
I need to count the number of times a character repeats itself in a string. For example: How many times the character / appears in the string down below?…
-
3
votes1
answer96
viewsHow to convert a normal integer name to its bibliographic format in c?
I want to know how to convert, for example, the following string: "Barack Obama" to "OBAMA, Barack". That is, pro bibliographic format, type when citing authors of books/articles. But I want to know…
-
3
votes1
answer1340
viewsRemove Accents - [ p{Incombiningdiacriticalmarks}] vs [ p{ASCII}]
I created a code in Java to remove accents as the following: private String removerAcentos(String texto) { texto = Normalizer.normalize(texto, Normalizer.Form.NFD); texto =…
-
3
votes2
answers1159
viewsConvert string to integer
I can’t convert my text TextBox in one piece. namespace Pag98_Exe1 { public partial class frmveiculos : Form { public frmveiculos() { InitializeComponent(); } Veiculos veiculos = new Veiculos();…
-
3
votes2
answers240
viewsString pointer does not work as expected
I’m trying to print the pointer of string below, and put yourself " %s " + char* t[]; makes mistake, already put %c he prints the letter " i " I don’t know why. I want to learn and not Ctrl + c and…
-
3
votes1
answer116
viewsHow do I collect a String and use it in an if?
puts "Tem dinheiro? s/n" x = gets.chomp if x = s puts "Vou viajar" else puts "Não vai ser dessa vez" end
-
3
votes1
answer1606
viewsHow to read from a file and save to variables in Java
I’m having difficulties, because in a file manipulation exercise in Java, the teacher asked us to create a program that takes the name and note 1 and note 2 of two proofs and store in a txt file as…
-
3
votes2
answers91
viewsUsing a variable as a C file name
I’m using the function system("pathping xxx.xxx.xxx > c:\i.txt") to leave the program doing tests pathping and saving the result in a file to analyze later. Basically wanted to play this role…
-
3
votes2
answers195
viewsHow to convert a string with minutes/month/year to Timestamp?
I am making a code for testing only. In it, I have the following String: String tempo = "1s"; //1 segundo This string is modified all the time: String tempo = "30d"; //30 dias So I want to convert…
-
3
votes3
answers962
viewsPrinting a character in place of a number
#include<stdio.h> #include<string.h> int main() { char str[50]; int i, l = 0; printf(" We will count the number of letters\n"); printf("-------------------------------------\n");…
-
3
votes1
answer778
viewsTypedef struct with C character array not working
I’m trying to create a kind of constructive data, but I’m having problems with the strings. typedef struct { char nome[30]; int idade; } p; p x,y; x.nome = “ana”; x.idade = 20; y.nome = “caio”;…
-
3
votes3
answers793
viewsCheck in Javascript if String has string x numbers
Hello, I wonder if there is any way to check if a String has Javascript, for example, 5 number in a random sequence to trigger an event. Therefore: abc123de45 Must be false abc13525de Must be true…
-
3
votes2
answers1911
viewsMysql - Search number in a string
SGBD: Mysql I have a table with a column of the type Varchar, with the following data: id Descrição 1 Pgto NF 66096 Lg Sistemas vcto: 01/10/2016. 2 Pgto NF 66096 Lg Sistemas vcto: 01/10/2016. 3 Pgto…
-
3
votes1
answer122
viewsError formatting string with number
I want to format a string so it has six digits filled with zeros on the left. I’m using the following code: string.Format("{0:000000}", linha.Quant.ToString()); He’s returning the next: 67 = 00067…
-
3
votes1
answer1959
views -
3
votes2
answers757
viewsCreate a Stream object from a string
I need to create an object of the type System.IO.Stream from the content of a string. This one of mine string is in an archive Resource.resx. I get her back that way: string xml =…
-
3
votes3
answers2248
viewsFill string with blank boxes
I need to format a string so that it contains only 30 characters. If you are less than 30, you should complete it with blanks, and if you have more, you should leave it with only 30. I know you must…