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
answer836
viewsRemove part of the string
I need to modify a string with jQuery. Suppose I have a variable address: var endereço = "Rua emanuel meira martins 85 cic curitiba..."; The idea is to remove all letters after position 15 and add…
-
3
votes1
answer3148
viewsPalindrome in C++
The code below works, receives what was typed and stores it, only it does not make the logic to show whether it is palindromic or not and does not present on the screen the result for the user.…
-
3
votes2
answers768
viewsString of characters inside the scanf. Why and how does it work scanf("Day %d",&dia);?
Problem I was making a code that would read a string and then an entire value: int dia, h, m, s; char dp; //Dois pontos. scanf("Dia %d",&dia); //Inicio do evento. ... I thought of creating a…
-
3
votes1
answer2118
viewsHow to remove non-alphanumeric characters without losing accentuation?
I am able to remove the non-alphanumeric ones as follows preg_replace('/[^a-z0-9\s]/i', null, $string ); However, in this way I am losing the accentuation of words, someone has some answer?…
-
3
votes1
answer426
viewsConcatenate string with int in printf
It is possible to do this in C: int MAX = 30; printf("\n| %".MAX."s | %8s | %8s |", "Nome", "Salario", "Idade"); printf("\n| %".MAX."s | %8.2f | %8d |", pessoa[i].nome, pessoa[i].salario,…
-
3
votes3
answers13033
viewsSplit to separate part of a string considers first separator
I have the following text:: _2910_0908_401 _600_ERV__P_119552_GUARITA ERV WITHOUT POWER RADIO INOPERAN_TE SEMAFOROS P TRENS AND VEICLS APAGADOS_PSG TRAIN C FLAG SIGNAL BY GUAR_ITA there use the…
-
3
votes2
answers1016
views -
3
votes1
answer1746
viewsHow to align a string in a 42-character space
I am generating a text file and have to align the company name to the center, but the company name will vary for each customer, the default amount of characters are 42. texto="lb_NomeEmpresa.text";…
-
3
votes4
answers1914
viewsTake accent from a string
I’m getting a string by POST, and I want to take out accent and add '_'if there is white space. I used the strtr but it doesn’t work for me. if (isset($_POST['txtnome'])) { $txtnome=…
-
3
votes3
answers2210
viewsRemove First Word from String
I have a stringBuffer with a sentence inside. I need to remove the first word from the string. Making the second word become first and the number of words x-1.
-
3
votes3
answers1994
viewsHow to count characters from a Java reference?
Example I have some characters 123456789.123456789. How to do to count up to the . after the . count again remembering that the point should not be counted.…
-
3
votes1
answer549
viewsHow to pass dates in Java to a database?
I’m trying to pass a date in format "yyyy/MM/dd HH:mm:ss" to the database for this I am using the Date() and the SimpleDateFormat(), but he returns me one string. Is there any way he can return me a…
-
3
votes2
answers4158
viewsHow to get the host name in Urls?
How to get the name of host of a URL like Mega, 4shared among others with PHP? In case you would like to know taking this URL as an example: https://mega.co.nz/#! 4090kJrY!…
-
3
votes1
answer4875
viewsReplace inverted bars with single bars - image URL
I am trying to remove the backslashes to open the image URL, I found a way to replace, but part of my string was lost: function formatURL( $url ) { echo $url."<br />"; $url = str_replace('\\',…
-
3
votes2
answers331
viewsCheck string value
I wanted you to check if the entered value is vegetarian, and if it is, print on the user’s screen is vegetarian as follows the code, but when I type vegetarians or anything else it warns that it is…
-
3
votes3
answers500
viewsHow can I separate a string for example 36529874 from two to two without having any separation carcter for example 36.52.98.74
I’m taking the IMEI of the phone and I have to divide it into groups of 2 characters for me to convert them to hexa later. This string comes without separator, the numbers come together, for example…
-
3
votes1
answer597
viewsconvert a string to Vb.net - Convert.toDouble
I’m trying to convert a string in double Vb.net: Dim result as double Dim ValueString as string = "-42.1942339" result = Convert.ToDouble(ValueString) Console.WriteLine(result) I’m getting the…
-
3
votes4
answers14347
viewsHow to take a String value before a Special character
Hello, good morning. I have a little doubt, how can I get the value of a String before some special character. For example, Clinica Antonio S/S. I would like to take only the Clinica Antonio S,…
-
3
votes2
answers635
viewsHow to split a string with delimiter in PHP?
have a string "1b00bd515bf8cbc5a86f3b714361fab6" and I want to share it that way: "1b00bd51-5bf8cbc5-a86f3b71-4361fab6" HOW DO I DO?…
-
3
votes2
answers1044
viewsString corresponding to real number
I am trying to check if a String x corresponds to a real number (any one). For this I created the following method: public static boolean Real(String s, int i) { boolean resp = false; // if ( i ==…
-
3
votes1
answer328
viewsRecover String between characters
Hello, I’m developing a program that uses the java command line if the user type: send -all < message to be sent > it sends the message to all if send -by < user > < message to be…
-
3
votes2
answers4494
viewsScroll through a list of characters
I have a method that checks the number of characters in a string, and separates them into variables with the information as can be seen in this example. The problem is when you have a list of data…
-
3
votes1
answer332
viewsHow to format values with custom string formats?
I am developing a graphic and would like to put the values of the Y axis as the image below: I have verified that it is possible to do this through custom string formats in that way…
-
3
votes3
answers3527
viewsSwap characters inside a string, in a string
Simple question: I just want to replace the characters A inside the field " " and not what is out for a B, example: aaaaaaaaaa"aaaa"aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa…
-
3
votes1
answer611
viewsProblem comparing strings and string being broken into two python lines
I was creating a game that scrambles words, and the user has 6 attempts to guess what the word is. I’ll put the code here: import random def main(): while True: input('Presisone enter para sortear…
-
3
votes2
answers5849
viewsHow to cut a string?
Example: nome = "Josénildo da Silva Ramos do Carmo"; Cut to have up to X characters, and look like this: nome = "Josénildo da Silva "; In this case I cut to 20 characters. How do I do this in C#? I…
-
3
votes1
answer124
viewsIs it possible to change a word from one string to another in the database via php?
I have been working on a method that will fetch all dates containing "2014" and replace that value with "2016" without changing the rest of the date. I’ve been able to return all columns containing…
-
3
votes3
answers917
viewsFormatting String with Dateformat using a Timezone is not working
In my web service, there is an endpoint that returns a timestamp to me UTC and I have a method that generates a date formatted from this timestamp: formatDate(1432313391, "UTC"); public String…
-
3
votes2
answers8188
viewsRead specific text inside a . txt in c#
I need to read a text file that contains several lines: 1 C0000000000 132008281 06140214 080515 0000000005990 00000000000000000000000000000000000599000000000000000000000000000 I need to take only…
-
3
votes2
answers345
viewsBreaking a string containing a polynomial
I created a class with two properties as in the example below: class Polinomio { private int coeficientes; private int expoente; } I will create a list to receive a polynomial type where I will…
-
3
votes3
answers3929
viewsLimit the size of a String?
I declared char pl1[10], pl2[10]; And I did this: printf("Nome do Player1: "); scanf("%10s", &pl1); printf("Nome do Player2: "); scanf("%10s", &pl2); Thinking he was only going to read the…
-
3
votes3
answers2918
viewsFormat a string with time
I’m trying to format a string that already has date and time, but this string just gotta get the time I’m trying this way but it doesn’t work: Recovering from Data Base. string dtSolicitacao =…
-
3
votes1
answer201
viewsHow to use string in C++?
I’m having trouble dealing with string. #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <iostream> using namespace std; bool ArqExiste(string Arquivo) {…
-
3
votes2
answers280
viewsHelp with Textbox / string parameters
I have this method where I would like to bring the IBGE. When I put Textbox as a parameter, it usually brings it, but the problem is that I am using a Library and cannot import Textbox. So I…
-
3
votes1
answer152
viewsSubstring(string.Indexof) is returning unwanted parts
I’m capturing a music site. I would like to return only 2 artist information and the music. She is in this code snippet: <div class="nowOnAir"> <a…
-
3
votes1
answer1030
viewsConvert String to monetary value in ASP.NET MVC
How to convert the result of a multiplication into a string to display as Real? The value of bol.ValorBoleto is loaded just before. To data Annotation: [DisplayFormat(ApplyFormatInEditMode = false,…
-
3
votes2
answers2523
viewsRemoving blanks from a string
I want to remove all blank spaces from one string, but I don’t know how to do I’ve tried to use replace but it didn’t work out.
-
3
votes2
answers912
viewsProblems with special characters in Asp.net GRIDVIEW
I am building a dynamic GRIDVIEW, where the information of each TD will be a DIV. exemplo: <td><div id="d1" class="redips-drag t1">z</div></td> I am filling the valve as…
-
3
votes3
answers2559
viewsIs it possible to add int with str composed of text and numbers in Python?
I asked that question Why in PHP the expression "2 + '6 apples'" is 8? here for finding this behavior strange. And in the case of python? I can convert the string '1' str for 1 int. Example: 1 +…
-
3
votes1
answer209
viewsHow to find specific values in a String?
I have to get the Ethernet adapter + IPV4 from Windows, until then everything is quiet. I ran the process and stored everything in a String Buffer and sent it back: public String IP (String tarefa)…
-
3
votes3
answers766
viewsHow to convert a String to Tnotifyevent in Delphi?
I want to change the Ontimer event from a Ttimer in my project at runtime, I tried as follows: Timer1.OnTimer:= ('close'); But Delphi reports this: (E2010 Incompatible types: 'TNotifyEvent' and…
-
3
votes3
answers272
viewsProblems with "strcpy" locking program
I’m solving an exercise where I have to fill a vector like struct, and one of the values is char, for that I made a while and was using a simple assignment with "=" but it wasn’t working, so I did…
-
3
votes2
answers928
viewsHow to scan a string and check content within it?
I need to do a check with a certain text within a string. How do I go through this string and search the text to make this check ? Example: If(dentro da string contém "Olá") { Mostre o valor…
-
3
votes1
answer112
viewsHow to read a variable in setText()?
I need the text of a lineEdit is equal to a variable string. I’m using this code: void MainWindow::on_pushButton_clicked(){ string texto; texto= "mensagem"; ui->lineEdit->setText(texto); }…
-
3
votes1
answer640
viewsMaximum size of sql query text
What is the maximum size of an sql query string? (Maximum query statement) Ex: SELECT * FROM ajuda WHERE (id = 1 OR id = 2 OR id = 3 OR... @Edit: The bank I was using (access) has other limits…
-
3
votes1
answer149
viewsHow to transform a String "Caiaaaque" to another String "Kayak"?
I’m developing a system where the user typed a wrong word, and I changed one or another letter of this word to correct, just for the purposes of studies anyway, and I have to go through the whole…
-
3
votes1
answer128
viewsWhy can’t I modify the string this way?
When we have a declared int variable, and then a pointer to that variable: int x = 10; int *p = &x; To modify the variable x through the pointer, we have to do: *p = 20; But when I declare: char…
-
3
votes2
answers8022
viewsConvert String to Date
I’m a beginner in java and I’m having doubts about converting String to Date. I already spent hours searching the internet to see if I could find a solution and I came across very few solutions but…
-
3
votes1
answer559
viewsI’m having trouble displaying the names of people over 18
/*Escreva um programa que receba o nome, profissão e a idade de 10 pessoas, calcule e imprima a quantidade de pessoas maiores de idade (idade >= 18 anos) e seus respectivos…
-
3
votes1
answer692
viewsHow to count how many characters a string has - Swift
I’m having some difficulties with simple things. How do I count how many letras has a variable? let word = wordEasy[0] for var i = 0; i < word.count ?????…