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
answer87
viewsHandling characters not saved in variables with F'strings in Python 3
To manipulate unsaved characters in variables with F'strings I do this: print(f'{"String":^20}') I wonder if this is right, or would it be a scam for the fact that I have to define the string inside…
-
0
votes1
answer47
viewsDisplay in a Messagedialog the contents of List<String> message = new Arraylist<String>();
Good night, I need to display the contents of the message array in a Message Dialog: List<String> mensagem = new ArrayList<String>(); In the course of code I add some text to the array…
-
0
votes1
answer150
viewsIgnore the header when inserting data from a csv file into a Java string array
Good night, I read a csv file and stored the information in a string array. The file from position 0 to 8 has string content, from position 9 to 29 has in its entire content. I need to compare if…
-
0
votes1
answer50
viewsSegmentation failure - C
#include <stdio.h> #include <stdlib.h> #include <string.h> int validaTipo(char t); typedef union{ struct contratoIndividual{ unsigned int…
-
0
votes1
answer148
viewsIs it good practice to use n to skip lines or to use a print() alone?
Hello, I already know that adding n to a string will cause a new line to start, but when I want to skip a line I should use n at the end/beginning of a string or should put a print() alone? For…
-
0
votes1
answer60
viewsCorrectly print a double value using Tostring()
I’m having difficulty printing a monetary value correctly with the distribution of its decimal places, I used the ToString() using parameters such as "C", "F" and "N", what needs to be done to leave…
-
0
votes1
answer909
viewsError returns Uncaught Typeerror: Cannot read Property 'substring' of null by clicking the button
I went to try to ride a script to verify the status in which the CPF was issued. However, I am unable to use the substring, it returns me the following error: Uncaught Typeerror: Cannot read…
-
0
votes2
answers88
viewsHow can I split a string by semicolon and take the value of each position after the while?
How can I make one split of a string per semicolon and take the value of each position after the while ? Example: result[0] //casa result[1] //carro My code: char str[] ="test;car;bar;mouse"; char *…
-
0
votes1
answer7301
viewsHow to break the line in a string in VBA?
I’m having a hard time putting a line break inside an automated email text by macro. I create the e-mail with the following Cód: "Necessitamos dos extratos do mês de " & Format((Month(Now) - 1),…
-
0
votes2
answers161
views -
0
votes2
answers2416
viewsHow to get the first word of a text in Python?
frase = str("Eu como abacaxi").split() How do I show only the first word of the phrase ("I" in case)?
-
0
votes2
answers1113
viewsComparison of python string inside if
My comparison of relatively simple strings doesn’t work and I can’t find the reason. # -*- coding: UTF-8 -*- import csv import os def sortKeywords(): keyw = [] sheetsList = os.listdir('.') for sheet…
-
0
votes2
answers97
viewsProblem with Python string formatting
First I would like to inform you that: (a) I am an accountant and I program only to help me with tasks with a large mass of data, so my code below will not be a professional code, and (b) this is my…
-
0
votes1
answer408
viewsString Formatting - PYTHON Alignment
my question is, instead of :>6, I wanted the user to be able to choose the amount of characters to be aligned to the right, for example, there instead of 6, I would put the variable n. However,…
-
0
votes0
answers34
viewsProblem: I have two strings, if I fill all the positions of the first string, it concatenates with the value of the second string
A simple algorithm to compare two cpfs: #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> int main(){ char cpf[11], cpfBusca[11]; for(int i = 0; i…
-
0
votes2
answers1284
viewsHow to check if a character is letter or number?
System.out.print("Frase: "); String frase = sc.nextLine(); // Exemplo: a1b2c3d4 for (int i = 0; i < frase.length; i++) { if (frase.chatAt(i)...........// Qual método ou lógica que verifique se…
-
0
votes2
answers155
viewsVariable receiving trash
Considering this simple password validator in C: #include <stdio.h> #include <string.h> int main(void) { char buff[5]; int pass = 0; printf("\n Entre com a senha : \n"); gets(buff); if…
-
0
votes2
answers39
viewsDelete string snippet whenever Python repeats
I have a Dataframe that in a given column there are many names and all these names have a type extension: "NAME A_SOJA_2020.xlsx" "NAME B_SOJA_2020.XLSX" I would like to develop a function or code…
-
0
votes2
answers651
viewsFilter column by string specifies
I’m trying to perform a filter on my dataframe (df_movies_usa) to eliminate all other types of currency not represented by "$". The coin is in the column df_movies_usa["budget"]. I’m using the…
-
0
votes3
answers108
viewsHow to replace a string depending on page resolution
I’m new to programming, so I don’t know how to use a lot of technical terms. I have an html pagination file. When I arrive on Mobile, the words "Previous" and "next" break line and stay below each…
-
0
votes1
answer44
viewsHow do I apply a condition to a line that skips the next line? (python beginner)
I’m very beginner in python and I’m making a simple calculator, but I have a question that I can’t find anywhere. I want to make a condition for, if the chosen operation is */ (what I used to…
-
0
votes1
answer42
viewsJavascript string?
How do you know the number of times a letter appeared in a Javascript sentence? Example: palavra = "a" frase = "Agora vai!" As shown on the console the number of times string "a" appeared in the…
-
0
votes0
answers37
viewsCompare a letter in a String array in java?
I’m doing an exercise in Java, on String, basically I have to enter a sentence with a maximum of 50 words separated by single space, after this check if all words start with the same letter, and the…
-
0
votes1
answer455
viewsProblem turning string into int: "error: no matching Function for call to stoi"
I’m writing a little show input a string of integer numbers as a string and as output an array with twice each of the numbers, also as a string. Despite the function atoi be indicated in that reply,…
-
0
votes1
answer59
viewsDoubt about the replace() method
The replace() method is a method of the str class, correct? Follows a code that 'rotates' perfectly where the object is an integer (or at least in my interpretation). Or in the case of interpolation…
-
0
votes0
answers46
viewsPick Url String in PHP
I’m creating a commentary system that can’t be "flooded". When informing the string url to the client, the example is just below, I can’t get the string value of the given url. It would need to be…
-
0
votes0
answers58
viewsFunction Improvement for Capitalize
This function returns me the first letter of each word in uppercase String(str).replace(/(^|\s)\S/g, (v) => { return v.toUpperCase() }) That is, this name Roberto if turn Roberto Monteiro but…
-
0
votes0
answers301
viewsError in string when connecting sql server database remotely
I’m a beginner in C# and I’m trying to remotely connect my application with an SQL Server database that is on another PC... In this PC has already been configured the TCP/IP port following this link…
-
0
votes1
answer47
views -
0
votes1
answer45
viewsHow to insert data into a member vector of a struct?
I’m trying to build a structure composed of members that are no more than strings. The 4th member is a string array, since it needs to store more than one piece of information. Once done I declare I…
-
0
votes1
answer20
viewsProblem alternating fgets and scanf_s
I have a problem that the user has to enter the name and age of 5 people, and have to print on the screen the name of the younger person. I made the following code #include <stdio.h> #include…
-
0
votes1
answer37
viewsHow do you move the first two characters of a word to the end of it?
How can I move the first two characters of a word to the end of it? For example: LUCAS --> CASLU casa --> saca I’ve tried using the replace transforming into list and read the first two…
-
0
votes2
answers129
viewsMatrix with C++ Strings
I would like to create a C++ Mxn array for storing strings, like the matrix below: [['3325309756482910474', 'CARRO', '2506794813021649539', '618.57'], ['3325309756485249504', 'MOTO',…
-
0
votes2
answers109
viewsIterating a string inside the for
As for can pick up the string backwards using Len with -1 -1 -1? nome = 'felipe' for c in range(len(nome)-1, -1, -1): print(nome[c], c)…
-
0
votes1
answer51
viewsStruct in C print nothing
Hello, I am doing a program for college and have to add books in a struct and then print your data, I created a menu of options and used ifs as a switch, one of ifs is used to add books to struct…
-
0
votes2
answers110
viewsHow to separate a string by passing more than one parameter
I have the following text file, except as texto.txt: Vamos testar nesse arquivo, aqui. Temos que pedir para, que separe "todos os caracteres"! Fazer, a contagem de letras? Fazer a contagem de cada…
-
0
votes1
answer32
viewsString for Vector(Array) in C
I am doing a code task and need to convert a string, for example: 123+* In an`(array) vector of type: 1 2 3 + * Does anyone know how I could do this in C? I’m a beginner and would like to learn.…
-
0
votes2
answers62
viewsHow to use print for special Python characters?
When trying to use print for a special character, I get the following error: print('\') File "<ipython-input-38-eaac87876c3b>", line 1 print('\') ^ SyntaxError: EOL while scanning string…
-
0
votes2
answers148
viewsFunction that displays the characters of a repeating string
Example: In the string "programming" the characters 'a', 'o' and 'r' must be returned. I did so but did not return what is requested. #include <stdio.h> #include <stdlib.h> #define DIM…
-
0
votes3
answers50
viewsDoes anyone have any idea why the if not be executed?
if (strcmp(letra4, "[") == 0) { char string_sem_colchete[10]; for(i=1; i<strlen(comando4)-1; i++) { string_sem_colchete[i-1] = comando4[i]; } string_sem_colchete[i-1] = '\0'; numero4 =…
-
0
votes0
answers22
viewsdifficulty extracting content from a file in a folder
Good afternoon, I am using the textract library to extract contents inside a folder and for that I am using a function that inserts the beginning of the directory('./book') and the extension of the…
-
0
votes0
answers23
viewscomparing javascript objects
to compare objects in javascript, I could turn these objects into strings and then compare them? would the result be correct? follows below what I did: let equalsString = (a, b) => { let…
-
0
votes2
answers68
viewsHow to use XML inside a String variable
I created a variable of type String that has the return of the webservice in XML: Example: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <books> <book> <author>…
-
0
votes1
answer81
viewsHow to use plural with String Resources?
For internationalization, Android uses String Resources. How can I use this feature to use plural to avoid multiple "gambiarras" if's? Example: <string name="friends_none">Você não tem amigos…
-
0
votes1
answer136
viewsExtract part of text in a variable
I am creating a script to backup some directories via powershell, but for a certain directory, I want to access a file, read a line and return a string with part of the line. XPTO file has the…
-
0
votes1
answer159
viewsJavascript beginner in programming
Help me execute this code correctly please! Now that you know enough Javascript, the jury of a programming asked us to develop the medallion function which returns the medal corresponding to the…
-
0
votes3
answers69
viewsHow to ignore other occurrences like this when capturing a snippet of a string?
I need to get just the ID of this line: "21 Julio André 21 Years" Since the ID is at the beginning of the line and is equal to age, the functions I tried to split the strings were Substring() and…
-
0
votes1
answer78
viewsI want to know how to show, for the user, Yes or No instead of True or False, respectively
Below is an example of what I’m trying to do: lm = input ('Digite uma letra ') print ('essa é uma letra minúscula? {}' .format(lm.islower())) I’ve tried to put True = Sim and False = Não.…
-
0
votes1
answer64
viewsEmpty object javascript
Hello I have a function that returns an Object with several functions inside, I need this object to be returned as string, but when I do the JSON.stringfy() it returns an empty object. Can someone…
-
0
votes0
answers55
viewsExcept System.Platformnotsupportedexception when trying to compile code with Codedom
I’m using a code, which I saw in a reply of this page: var csc = new CSharpCodeProvider(); var parameters = new CompilerParameters( new[] { "mscorlib.dll", "System.Core.dll" }, "teste.exe", true) {…