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
votes2
answers4198
viewsDo a string check?
At the event keyup of a input I want to verify the following cases: If string has letter and number "abc123"; If string is uppercase and lowercase "aBc"; If string has no numeric alpha character…
-
1
votes1
answer3392
viewsAdding character to a string
Good person my doubt and the next, I have the following situation: i have the following variable >>> a = "EXAMPLE" Let’s assume I had to remove the letter "M" right string, in this case I…
-
1
votes3
answers1340
viewsRemoving spaces from a text file
How do I remove spaces from a text file? I have the following text file: LC1 00019 1 31012012 00001 00243206 I uploaded and put the following code: $abrirArquivo = fopen($uploadArquivo, "r");…
-
1
votes1
answer88
viewsExit loop as soon as the string name equals 0
#include <iostream> #include <locale.h> #include <stdlib.h> #include <stdio.h> #include <string.h> using namespace std; int…
-
1
votes1
answer189
viewsSegmentation failure
I created a class to display a string at the terminal, but in addition to displaying the string, also, displays the following message: "segmentation failure". I debug with GDB, but could not resolve…
-
1
votes3
answers210
viewsHow to recover the first letter of a Swift array
I would like to know how to retrieve the first letter of an array element var wordEasy = ["uva", "manga"] var teste: String = wordEasy[0] I would like to retrieve only the letter u…
-
1
votes1
answer5307
viewsSpace in a String C
I’m starting to learn C, and I came across the following doubt: When I ask the user to inform me a song or artist, he ends up informing me a song with spaces, like "AS I AM", however the program…
-
1
votes1
answer1909
viewsHow to convert decimal to binary with large numbers?
I am creating a program in C# language to perform conversions I am currently implementing the binary -> decimal and decimal -> binary. How can I do the conversion if user type large numbers as…
-
1
votes1
answer226
viewsSegmentation fault function fgets
I’m having a problem segmentation fault in file opening txt. I know for manipulating strings, higher level liguagens, but I have no way to learn now, so I’m using C. My problem is to read a list…
-
1
votes1
answer1115
viewsProblem with split function in C
Hi, I’m studying the C language and came across a pointer problem in a string breaking function. I use the version GCC 4.8.4. The error value is "1234|123|123|123|123" 4/3/3/3, while other values…
-
1
votes3
answers9575
viewsAllow only letters, numbers and hyphen
How to validate a php string to contain only letters, numbers and hyphen ( - ) Thank you
-
1
votes1
answer199
viewsHow to provide a specific amount of strings to be tested?
I can test whether a user-provided string is a palindrome or not (word or phrase that can be read backwards by ignoring upper and lower case spaces and letters such as: Help me get on the bus in…
-
1
votes4
answers12868
viewsHow to print multiples of N in a range?
The program must receive as input three values N, A, and B, and must print the multiples of N contained in the interval between A and B. I am doing it as follows, but it is going wrong: N =…
-
1
votes1
answer99
viewsPHP Arrays and Strings Interface
Situation I have a page in PHP that does CNPJ searches and returns the values, but as it is without any formatting the results appear in forms of ARRAY and STRINGS. Example array(23) { [0]=>…
-
1
votes1
answer6279
viewsConvert String to Double while maintaining content
I need Java to convert a String which has a binary value (Ex: "0111010") for a double. I tested: String teste = "101010101"; double number = Double.parseDouble(teste); System.out.println("The number…
-
1
votes2
answers216
viewsReturn information from a String
I’m trying to return the information from a String. What I need is to pass a String parameter and return the information that is in the indicated places. Ex.: String FraseParametro = "<R1>…
-
1
votes2
answers350
viewsDoubt in string, and comparison
I am doubtful in the following exercise: Write a C program that receives two strings via standard input and whether the second string is contained in the first string, i.e., if the second string is…
-
1
votes1
answer102
viewsA comparison between 2 char(s) is wrong
I’m manipulating a string with a loop for... which generates a new string of the same, starting and ending from a certain position (would be "Hello" in that case). When comparing the return of the…
-
1
votes1
answer100
viewsError sending - get request.
Considering the code below: path = "/admin/" host = "192.168.1.1" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, 80)) req = ("GET /"+path+" HTTP/1.1\n Host: %s \r\n\r\n",…
-
1
votes1
answer737
viewsMake Variable with multiple names and a single Value String
It would be possible to create a single variable that has mutual influence by other names in it. In other words, different names for the same statement var, and in the end they will have the same…
-
1
votes1
answer405
views -
1
votes1
answer71
viewsstring comparison + linkedList
Good evening, I am trying to compare a string with a Linked list but I am not having success, the Linked list is being returned a value of another function but I will put here the output of the…
-
1
votes1
answer2870
viewsPrint a list of objects as string in Python
I am making a program in python(2,7) where I take texts from a file,and storing as objects in a list, I would like to print the list but only returns the addresses, I am learning to program in…
-
1
votes1
answer133
viewsIs there any way to access a position by string?
There would be no way to access a position using a string? Example: int vetor[1000000]; vetor["abc"]++; I know it’s crazy of me, but... "abc" = 01100001, 01100010, 01100011, 00000000 (null…
-
1
votes5
answers14748
viewsTake part of a string delimited between characters
I have a string as in the example below: $string = 'Lorem ipsum dolor sit amet, consectetur /adipiscing elit/.'; My question is, how can I only get the part of the text that’s between the bars /,…
-
1
votes2
answers1178
viewsDecrypt a code (as I understand it is in ASCII)
Well, basically I’d like to know if there’s any way to turn a script written in ASCII into Characters and if there is, how would I turn it? Code (1) local code =…
-
1
votes2
answers4207
viewsCapture file name
I have a form that I search the path of a file in .mdb (Access database), however I wanted to know how I can limit and pick up exactly the string of the file between the last bar of the…
-
1
votes1
answer602
viewsExchange accented characters for accented characters
There’s some kind of method of me making a replace in characters based on CASE? I’m looking for something like this: UPDATE foo SET bar = SUBSTRING(bar, "Ã","ã"); -- se o caracter for LOWER -> ã…
-
1
votes3
answers399
viewsDoubt about C pointers
void imprime (char *v, int n) { char *c; for (c = v; c < v + n; v++) printf ("%c", *c); } I have this function, but I don’t understand what exactly she’s doing and how the pointers behave in this…
-
1
votes1
answer151
viewsFunction that reads a double of a string and returns the rest of the string in C
Is there any function of the type? Which reads and stores or returns a double of a string and returns or pointers the rest of the string or do I have to do my own function? If there is no one have…
-
1
votes2
answers559
viewsHow to handle an empty string?
I need to convert a string taken from a text file and fill in a person class where, each attribute of the class is separated by "," in the text file. Attributes are only: height, weight, age. In the…
-
1
votes2
answers252
viewsError comparing two C strings
I type a value at the command line. That is in the binary vector. But if it is not return to the message from printf. But my problem is that it always goes into the cycle if, regardless of whether…
-
1
votes2
answers1031
viewsDivide vector according to delimiters and copy content to other strings in C
I need the main string "vector" to be traversed to the delimiter '=' and copy the values before '=' to "second" and the values after '=' to "third". I’m sure there’s a smarter way to do this, but as…
-
1
votes2
answers95
viewsTurn a JSON string into a non-associative array in PHP
Good afternoon, would like to convert a string into a non-associative array in PHP, functions like json_encode/json_encode are not working properly. String: word =…
-
1
votes2
answers2096
viewsFind a string anywhere in the List c#
Good Afternoon. I would like to know how to find a string anywhere in the list. Ex.: string "123". It can be in Pessoa.id, Pessoa.Nome, Endereco.id, Endereco.Rua or Endereco.CEP; People’s List…
-
1
votes1
answer176
viewsError accessing string array
I have the following code: #include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char v[]= {'Brasil', 'Alemanha', Japão'}; int i = 0; for (i=0; i<4; i++){…
-
1
votes1
answer105
viewsSplit "100000000000" in JQUERY
I need to separate all the characters of a string into an array, and I have a problem, my code is the following var PISCampos = campos.split(""); When sending fields in the variable the following…
-
1
votes1
answer1567
viewsstrcpy() in struct string
I have a struct Time that has a vector char name[30], the problem starts when I try to copy a value to that string with the function strcpy(), follows the code of stuct: typedef struct Time{ char…
-
1
votes1
answer452
viewsSolve mathematical expressions in java using string
I cannot make this code solve the expressions contained in the database. In the database, the expressions are like this: All expressions registered in the database follow the pattern described…
-
1
votes2
answers53
viewsError using values string
Hello, I’m using string within values. Everything is working fine, but when the phrase is composed of something that comes from the bank (for example) and a string, it is putting numbers instead of…
-
1
votes1
answer397
viewsNMAP result using PHP - how to show the NMAP result in a table in the browser?
I am trying to make the output of nmap result appear in the browser in the form of a table. follow the code below: <?php $host = $_POST["host"]; $saida = shell_exec('nmap -P0 ' . $host);…
-
1
votes1
answer49
viewsI would like to turn "a"+str(1) into a1 without being a strig, so I can associate a value "a"+str(1)=2 as I do?
"a"+str(1)=2 File "<ipython-input-44-929460161ba7>", line 1 "a"+str(1)=2 ^ Syntaxerror: can’t assign to Operator I want to create a series of variables a1 a2 A3 an and then associate to a…
-
1
votes2
answers955
viewsHow to print the day numbers of each month using Array, String and byte?
I’m trying this code, but it doesn’t work. public class MesDias { public static void main(String[] args) { // Array String byte String Mes = {Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov,…
-
1
votes1
answer4117
viewsConvert ISO-8859-1 string to UTF-8 in java
My goal is to create a converter ISO-8859-1 for UTF-8. I already have this code: import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException;…
-
1
votes1
answer166
viewsSplit string by letter sets with numbers
I have the following string in a given array: [est] => INA1C4A1 I need to divide into sets: [0] => Array ( [mov] => IN [seq] => Array ( [0] => A1 [1] => C4 [2] => A1 ) its…
-
1
votes3
answers174
viewsJava Strings Comparison Error
I have the following situation. I get a string that is in the application’s localStorage in a javascript variable. <script> var sendForm = localStorage.getItem('f'); </script> This same…
-
1
votes1
answer579
viewsHow to display the recovered String value of the JSF session?
I am facing a problem when trying to display, in xhtml, a String value recovered from session. What I want is to show the value of a String attribute (attribute name) of an object of the class I…
-
1
votes1
answer272
viewsI can’t get some strings from the strings.xml
I want to get a String that is in the strings.xml file, but always gives the following error: java.lang.RuntimeException: Unable to instantiate activity…
-
1
votes1
answer386
viewsReplace is not working C#
I’m replacing one code with another in each row that the code is found on. But replace simply doesn’t work, goes through it and the line continues the same way. As you can see in the image below, if…
-
1
votes1
answer301
viewsShow typed string string
How to show read values inside a repeat loop in Java? Ex: for(int i = 1; i <= 2; i++){ System.out.print("Nome: "); String nome = tecla.nextLine(); } ?? <- Make the read names appear here…