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
-
0
votes1
answer1139
viewsPrinting of predefined phrases at random in C
Hello, I’m a beginner in programming and I’m learning to code in C. I want to do a show that has some sentences already defined. Ex c/ vectors: char vet1[100] = {"Hello World!"}; char vet2[100] =…
-
0
votes1
answer159
viewsAssigning lines from a document to a String array
I am trying to assign to a string array certain document lines, the content of the document is this: 3 50 5,80,0 15,5,1 12,30,0 I want, from the third line, each row to be stored in a given Dice of…
-
0
votes2
answers99
viewsArray returns wrong value in java
I have a question about a college job. I can read with numbers, remove ";" and pass the values to the array while reading the file. However, when I try to access a position of the array outside of…
-
0
votes1
answer113
viewsSPLIT_STRING in several 'paragraphs'
I’m trying to take this kind of table: In which I have a daily import for a dbo, I now have difficulty split_string the comments, cross with the ID. The idea is to have as many lines as (additional…
-
0
votes1
answer93
viewsString Handling - Javafx Application
I’m having a problem I’m reading a file and I need to remove the accents of the string, however, the function is not working in my Javafx application. Function: public static String remove(String…
-
0
votes1
answer99
viewsCan you store hash code in a database?
I was reading some questions here and a doubt has arisen in one of these questions. If I have an application that I need to store strings in a database to compare later with something, but I don’t…
-
0
votes1
answer317
viewsprinting memory junk
This program must load words from a file txt to a vector, Draw 10 words, put them in vector and then print on screen. The problem is that it is printing memory junk and do not know how to solve this…
-
0
votes0
answers69
viewsCalculate Values in Gaps in Form
Good afternoon! I’m having doubts about implementing an algorithm that can calculate the heat flow based on the formulas: q=ΔT/Rt ΔT=Temperatureinitial-Temperaturefinal Rt(Thermal…
-
0
votes2
answers99
viewsI’m having trouble reading a string inside a function
Good evening, I would like to know methods to read a string in C(Version C99), I have tried a lot, and does not work, below, the defective code. Obs: The error that reports is that just after…
-
0
votes1
answer306
viewsString Encoding - Haskell
The following code encodes a sequence of equal characters, replacing the sequence with ! na, where n is the number of times the character a is repeated. Note that it only compresses sequences…
-
0
votes1
answer334
views -
0
votes2
answers422
viewsProblems converting integer to string (stringstream) c++
#include <iostream> #include <string.h> #include <sstream> using namespace std; int main(int argc, char *argv[]){ int n, aux; string hexa=""; stringstream hexa_aux; cin >> n;…
-
0
votes2
answers492
viewsString counter in Arraylist
I need the program to return the amount of times each String repeated itself within the ArrayList, but I could not think of a way in which my counter is reused for each item, because as it shows…
-
0
votes0
answers75
viewsHow do I convert Date to String ? (Java Language)
public class Passageiro { public static void main(String[] args) { Viagem passageiro = new Viagem(); passageiro.nomePassageiro = JOptionPane.showInputDialog("Digite o…
-
0
votes1
answer585
viewsError returning Stringstr
I have the following function in php it returns me a page string so that I can do if and Else with the returned information, but there is an error: Parse error: syntax error, Unexpected '=' in…
-
0
votes1
answer659
viewsApply data from a txt to Arraylist
I need tips on how to create (where to start, what functions to use, etc). A generic project that receives a file .txt, read the data and store the words in a ArrayList<>. I’ve already created…
-
0
votes1
answer189
viewsCheck if typed string is in email format
Guys, I need a little help to check if the email you typed ends with "@usp.br". Here’s the code I’ve tried: /* pega o tamanho total do email digitado */ int tamanho = strlen(email); /* a partir do…
-
0
votes1
answer54
viewsConnection error mysql_query
#include <mysql/mysql.h> #include <iostream> MYSQL connection; void data_insert(); int main(){ mysql_init(&connection);…
-
0
votes1
answer752
viewsCompare two simple strings in C, input with scanf();
what I intend to do is quite simple. I make the program ask for a password, the program compares, and if the password is valid, the program proceeds. An example: char pass[5]; printf("insira a…
-
0
votes1
answer234
viewsString for an array within a loop - javascript/nodejs
i want to pass the strings of a txt file to an array and as soon as each line was passed to the array the program would run it normally, then he would repeat and pick up the second string of the txt…
-
0
votes2
answers1092
viewsSeparating small strings from a giant string
Hello. I have to do a function to read a huge string and then divide it into small strings for each field. Each field would be separated by ; example: BRUNNY;PR;MG;T;Câmara dos Deputados, Edifício…
-
0
votes0
answers140
viewsConvert path C: to C:
I am trying to take the path that is stored in the bank and open by the explorer, and for that I used the code below path =…
-
0
votes1
answer16507
viewsHow to print a string from a string array in C?
I have a string vector(palavras[x][y]), I can read every word that will be an element of the vector, but I cannot print any of these stored words. printf("%s",palavras[a][b]), doesn’t work. Here are…
-
0
votes2
answers2921
viewsConvert String to Integer on Android
Guys, I had already opened a question related to this subject but in java(Here), I could not solve and now in an android apk I have the same problem. I have a service with a thread running a server…
-
0
votes1
answer1042
viewsTransforming string in time in Javascript
I am developing an application in Vuejs and on a screen I have two input’s of hour and are being saved in Mongodb as String. However the input only accepts in the time format and when I click on the…
-
0
votes2
answers118
viewsIncorrect value in subtraction of binary numbers using strings
I made this code and it basically gets two numbers in binaries (no separation of spaces between bits), and Performa (at least in the values I tested) the subtraction correctly. I tried to prevent…
-
0
votes1
answer815
viewsHow do I create a char variable with an indeterminate size
How do I create a char* variable (to store a name) with an indeterminate size? Example: char nome[30] = { 0 } // 30 é o valor máximo e no caso se a pessoa tiver um nome grande? que ultrapasse 30?…
-
0
votes1
answer488
viewsProblem with accented JSON text - Android + Retrofit
I am consuming data from a webservice that returns a list with JSON objects, this way: [{"idPDV":3062,"nomeFantasia":"SEBASTIÃO JOSÉ DOS SANTOS","endereco":"RUA MANCHE CATAN DAVID,…
-
0
votes1
answer387
viewsremove parts of a string and return the removed parts - Swift
How do I remove parts of a string and return those parts removed to another string on Swift? Example: var myString = "10setembro2017" let newString = myString.removeAndReturn(index:1..2)…
-
0
votes3
answers5033
viewsFind Strings in Text Files in PHP
I have a file called "test.txt" inside it has several words, I have an input where I get the word inserted and I would like to check if that word is contained within this ".txt file". Someone knows…
-
0
votes1
answer113
viewsHow to turn into a tiny value of a struct?
The next function should turn variables into lowercase and then compare them. I’ve tried converting before, but also bugged. Arithmetic use of pointers together with variables of a struct. Pointer…
-
0
votes3
answers218
viewsDictionary does not return all possible words
The idea of the program is to be a dictionary, the user informs the word, the program performs a check on the characters of the word finds the position in the vector and returns the definition if…
-
0
votes0
answers149
viewsCheck for the word in the string using string array and separate the string in a new array
I’m in a problem where I want a string to become an array with separate words, only the code returns duplicate arrays var string = 'xicara,cafecafe'; var array1 = ['casa', 'xicara', 'xicarada',…
-
0
votes3
answers5991
viewsConvert number to string to two decimal places
Imagine a string with the following value: 12,126456 How do I convert the string to 12.12? I need to convert, using C#, so that the final string has at most two digits after the comma. tried the…
-
0
votes1
answer50
viewsSplit string into parts with 2 parameters to find
Here is the code that takes description of the 2 column of the table var descricao = $(elemento).closest('tr').find('td').eq('1').html(); that and the description CALIFORNIA [2,90] [BRE25] [3x80]…
-
0
votes1
answer269
viewsFormat string in PHP
I saw some examples here on Stackoverflow, but I just couldn’t. I need to format this string: 'personalization_id="v1_i8b1bAFy7m6K+j3TseNGDw=="' If I use one $cookie = explode('=', $cookie); she…
-
0
votes3
answers9910
viewsRemove first and last character from a string
I need to remove the first and last character from a variable String, tried to use substring for this, but is giving the following error: String index out of range And I’m not finding a way to do…
-
0
votes1
answer288
viewsIs it possible to define an HTML tag in a C#string?
I have the following string written in C#: string Descricao = "Você ficou muito tempo inativo, e por isso sua sessão caiu. Retorne para a página inicial para continuar." I would like to put the…
-
0
votes1
answer362
viewsFind text in sequence in a string
I have this String in oracle: 'Order linked with Sale : 4575987/10' and I would like to return only the order number in this case the 4575987/10. Until now the maximum I could is passing a fixed…
-
0
votes2
answers337
viewsdetect repeated char in c++ string
Hello, I’m trying to make a code to detect the occurrence of parentheses Na(CO5(Pt Let’s assume something like, I would have to detect the position of the two parentheses that are in the string. I…
-
0
votes2
answers418
viewsError . class expected
The program is supposed to ask for a number between 1 and 12. (I haven’t gotten to the part of certifying that it’s between 1 and 12 but this is the easiest.However I’m supposed to write the code…
-
0
votes1
answer32
viewsCompare to remove_if in c++ does not accept char
Hello, I’m trying to use a remove_if in c++ but when it gets to the input part I can’t determine for it to detect if the string I’m pointing has a char. Follows my code:…
-
0
votes1
answer143
viewsUse toLowerCase() on a string array - Angularjs 5, Typescript
I’m trying to transform an array with strings inside in lowercase using toLowerCase, but it doesn’t seem to work with an array, but only with a string... How do I fix it? items: Array<{tag:…
-
0
votes1
answer81
viewsFind string character position and remove it
I have a complicated problem to solve, there are 3 types of variables that receive data via post example: $mes = "08"; $mes = "10"; $mes = "12"; In the case of 3 different types of string, I need 0…
-
0
votes2
answers354
viewsTwo strings starting from one, in C
Hello, I need a software that reads a full name, composed of a simple name and a surname, separated by "_" and prints them separately. The code should use the following main function: #include…
-
0
votes2
answers156
viewsHow to validate an upload by file name?
I am trying to validate the upload of a file , and the same should always be called new.mpg, if not, the program will not work. function validarNomeArquivo(){ //variavel que recebe o nome do arquivo…
-
0
votes1
answer3628
viewsRecoverable error fatal error: Object of class mysqli_result could not be converted to string
I am unable to save the ID of the address in the bank, I select the address but I can’t <?php session_start(); $host = "localhost"; $user = "root"; $senha = ""; $banco = "cafeteriasp"; $conexao =…
-
0
votes1
answer9962
viewsConverting int to string
I made a program that simulates a login and when converting the password that is int to string using sprintf it from segimentation falt, I tried to use itoa but it from the definition error #include…
-
0
votes1
answer103
viewsInclude spaces when reading C strings
Good staff I have a C job to do, where I have to read information from a txt. Each string follows the following format: 12345António Manuel Silva Mendes Frankfurt Varsovia 1 It always has a…
-
0
votes3
answers16701
viewsThe ' ' (SPACE) character, counts in the string in the C language?
For example, it will only save the first letters before the space array, why ? Does anyone know how to explain ? #include <stdio.h> int main(void){ char nome[20]; printf("Digite seu nome: ");…