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
-
-2
votes1
answer188
viewsHow to delete the line in memo according to the amounts of Numbers in Delphi?
Good Night, I have a memo that takes several strings and in many lines, I want to delete the lines that contain less or more than seven(7) numbers ,leaving only the lines that have exactly seven(7)…
-
-2
votes1
answer49
viewsHow to Shuffle String Value? (JAVA ANDROID)
The thing is, I’m creating an android app and I prescribe shuffle the value of a string. Example: String name = "Bruno"; Shuffles the string value(name). Output: "ronub"…
-
-2
votes1
answer38
viewsI would like to leave the data.frame without repeated elements used this code:
f<- c("Juca", "Sam", "Ze", "Anta", "Buddy", "Irma") f<- sample(f, 3, FALSE) a<- c("Juca", "Silas", "Ze", "Ziraldo", "bar", "Ramister", "Luizinho") a<- sample(a, 3,…
-
-2
votes1
answer39
viewsRemove Characters from String
I have this field below that returns from my API, but as you can see it is with \n, \r and \ amid :na categoria \"A ou B\" I’d like to remove them: `"observacao":` `"Conforme Resolução CONTRAN…
-
-2
votes1
answer73
viewsI’m doing an exercise and I don’t know why it’s going wrong (print exercise in the post attachment and my code below), what’s wrong?
Myio is used by my teacher to replace scanner and etc the strings I’m going to use in the exercise are large and diverse so any example you think about is the basis. is my first post, I’m sorry if I…
-
-2
votes1
answer56
viewsHow to see if a string has numbers
I want to make a program that reads a string and returns "+" in front of all the numbers. Example entree: a 1 2 b 3 exit: a +1 +2 b +3 i did it: #include <iostream> #include <cctype>…
-
-2
votes1
answer61
viewsGet pathlib file name only
I currently have the following code: from pathlib import Path for file in Path("resources/maps").glob("*.json"): print(file) Which returns: resources\maps\map1.json resources\maps\map2.json…
-
-2
votes1
answer36
viewsConcatenate string into C
Good afternoon guys, I’m starting my studies in c and I found a problem trying to concatenate strings. #include <stdio.h> #include <stdlib.h> #include <string.h> int main () { char…
-
-2
votes2
answers556
viewsReceive multiple strings in the same row in C
I have the following code that gets the keyboard input and prints on the screen what was typed. #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char…
-
-2
votes1
answer32
viewsMultiline string problem for twitter API in Dart
I’m creating a bot that tweets on Dart. I’m having problems because I want to post with line break but I can’t, the following error appears when I try to convert a string into json through the…
-
-2
votes1
answer44
viewsExchange vowels for "*"
I’m making a program to replace the vowels of a typed phrase with * and show to user: #include<stdio.h> #include<string.h> #define TAM 50 int main(){ char f[TAM]; int t_f,n;…
-
-2
votes1
answer38
viewsRemove whitespace excesses from a string
I need to make a program that reads a text file, copies the information and transfers it to another file, but without the blank lines, without comment code (which starts at "//") and remove excess…
-
-2
votes1
answer39
viewsHow to read each char of a string, to know if one is contained in the other, in C?
Good morning, good afternoon, good evening. I’m trying to make a statement from my C programming course that asks me to make a code that checks if a string2 is contained in a string1, using pointer…
-
-2
votes0
answers41
viewsHow to Map String Characters
I have the following array with a string inside. let fruta = ['banana']; fruit is the name of my array and banana is the string. my intention is to create a code that Mapeie the string 'banana'…
-
-2
votes1
answer26
viewsHow to store special characters in strings and print to files?
Recently I’ve been working on a C project that involves printing some strings in a txt file. However, when I put special characters and accents are printed some strange symbols, like ‡ and Æ. I made…
-
-2
votes1
answer80
viewsI can’t replace characters from one string to another - Is this a Javascript bug?
I am trying to make a substitution effect from one string to another, but without deleting the contents of the first string altogether. As if it were a special effect, each letter of a string turns…
-
-2
votes1
answer45
viewsCreate a C function, which searches how many times a letter appears in a string
I need to make this function count how many times a letter has been said in the string. However, the result always returns 0. #include <stdio.h> #include <string.h> void contador(char…
-
-3
votes1
answer231
viewsCompare string[] with string
I tried so: IWebElement descriptionTextXPath = driver.FindElement(By.XPath("html/body/div[1]/div[1]/div[2]/div/ng-include[1]/section/ul/li[1]/div/div/article/h4")); String h4 =…
-
-3
votes3
answers210
viewsHow would I look regex to handle this case?
I’m not able to separate words this way: In case I have CPFConsole, wanted to separate to cpf and console. The code I have separates so: ([A-Z][a-z]+)|([a-z]{0,})|([A-Z]{2,}) But that code separates…
-
-3
votes2
answers382
viewsExtract values from a javascript string
I have a page that presents information through AJAX. Each time I do a search, I have the value of the search and page on URL, as follows: /Material/Index?? palavraChave?? numPagina I can trace…
-
-3
votes1
answer12496
viewsConvert received value as int to char type in C
I am doing a college job in which I have to convert a received value to char so that I can write it out in full for example. Help me create this function.
-
-3
votes1
answer39
viewsLimit a specific value to a string
need to limit and a specific value that would be 511 char command[512]; I tried with char command[512]; scanf("%511s",command); if (StrToInt(command))>511) printf("FIX ATK"); and that too char…
-
-3
votes2
answers275
viewsFind patterns within a String
I’m having trouble finding two patterns inside a java string, given a string. For example: String str =…
-
-3
votes1
answer88
viewsmain(String[]) exceeds 65535 bytes limit
Hello. I need to execute the code below with values that exceed those allowed by the main string, what I do? It is a list of numbers exceeding 65535 characters. in reality the program will be used…
-
-3
votes2
answers45
viewsPrint subtrings recursively
I need to print substrings for a string, for example: OPEN, substrings are OPEN, OPEN, ABR, AB, A. How do I do this? 'Cause all I’m doing is printing the whole string. #include <stdio.h>…
-
-3
votes1
answer637
viewsAdd numbers from multiple Strings in PHP
How do I add the numbers of several Strings in PHP, for example: string(2) "66" string(1) "5" I wish to obtain the result of 66 + 5 = 71.
-
-3
votes2
answers129
viewsRead an integer greater than 0 and return the sum between the numbers that compose it in Python
Could someone give me a light on how to make a code, in Python, that reads an integer number greater than 0 typed by the user and add the numbers that make up it? Ex: User type 129 Program returns…
-
-3
votes2
answers107
viewsconvert strings to python
I am having doubts to resolve this exercise. First, follow example of txt file. 5/2 500+20 200-20 20*10 I need to read this txt file and solve the equations in Python. Follow the code I currently…
-
-3
votes2
answers163
viewsString replacement in javascript
I have an input that receives a code composed of 4 letters <p>Localidade <input type="text" id="localidade" oninput="MyFunction()"> <span id="ca"></span> </p> I intend…
-
-3
votes2
answers126
viewsHow to operate on the counter of a while in each loop iteration
Sorry my ignorance I’m starting to learn python now, my doubt is: How can I generate a result in each iteration of a while. valor= input('digite o numero desejado:') contador = 0 while contador…
-
-3
votes3
answers638
viewsComparison of strings in exercise!
My exercise reads as follows:: Define the philosophic functionHipster you receive as a parameter: a person’s profession (string), nationality (string) and the number of miles he walks per day…
-
-3
votes3
answers98
viewsWhy is the expression ``` == '`' true?
I really want to understand why in Javascript this code gives true. I couldn’t understand that logic, can someone please explain to me? console.log(`\`` === '`');…
-
-3
votes1
answer52
viewsHow do I check if a STRING has more than 3 characters?
I need to check if a string has more than 3 characters, how do I do this? I’ve tried it like this: nome = input('Digite um nome: ') a = [i for i in enumerate(nome)] print([i for i, y in a]) if a…
-
-3
votes2
answers64
viewsBug when adding elements to the list and transforming it into a string
I’m trying to headache in the course of a mini-project to develop a hangman game, in the function that would return the string containing the hidden word, showing only the guessed letters. I’ve…
-
-3
votes3
answers71
viewsYou are not printing string
Good morning, someone can help me? It is intended to develop the function invert_pal(st) it takes as parameter a string st and returns as a result the same string in which each word was inverted.…
-
-3
votes1
answer71
viewsSum values of a string by assigning values to letters (Python)
Goal: Assign values to a string based on a dictionary with keys and values Example: I have a string in this format: str = 'ABCD' and a dictionary in this. dic = {'A' : 71, 'B' : 103, 'C' : 115, 'D'…
-
-3
votes1
answer128
viewsSeparate string that has no bounders
My intention is simply to take a part of a string that I know from position 0 to position 29, for example, contains a proper name. And from position 30 to position 45, is the phone associated with…
-
-3
votes1
answer1234
viewsCreation of two dictionaries from a dictionary with one criterion
Read and store in a dictionary the name, age and phone number of your contacts, the key being the name. When typing an empty string for the name, the program stops reading and closes. Display the…
-
-4
votes2
answers456
viewsRead an excerpt from a String
As you saw my question above, I want to pick up only one part that interests me from a String, for example, I have a String preco whose text is R$ 20,00, how do I take only the number ? Another…
-
-4
votes1
answer159
viewsImprove the performance of a pointer method
Here’s the code working: string string_pick(string text, string tag, char caractere) { int index = text.IndexOf(tag); return text.Substring(index + tag.Length, text.IndexOf(caractere, index +…
-
-4
votes1
answer87
viewsWhat does the "arguments" function written in PHP do?
Complete code function argumentos($argv, $campo) { $_ARG = array(); foreach ($argv as $arg) { if (ereg('--[a-zA-Z0-9]*=.*', $arg)) { $str = split("=", $arg); $arg = ''; $key = ereg_replace("--", '',…
-
-4
votes3
answers1367
viewsPlacing spaces between letters of a text
As if a certain string as "Something" was with spaces between the letters as for example "A l g u m a C o i s a"; as I do it in C#?
-
-4
votes3
answers174
viewsSeparates letters by javascript line
I am new to programming and would like someone to help me, please. I need to sort the letters one word per line var n=require("readline-sync") var b1 var b2 b2=n.question("Digite uma palavra")…
-
-4
votes0
answers23
viewsGood afternoon, I’m a beginner and would like your help
Oops guys, I’m a beginner in the field and would like course tips, or any other kind of improvement and improvement in my C/C language development++. I am in the 2nd period of Computer Science and I…
-
-4
votes2
answers139
viewsRemove special characters while maintaining accents
I have this function below: <?php $titulo = "Notícia Com Ácêntös"; $titulo_novo = preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'), array('', '-', ''), $titulo); echo $titulo_novo; //…
-
-4
votes1
answer31
viewsproblem with if and Else
i was in the middle of a java class and my eclipse ide just doesn’t recognize any, IF I’ve been trying for a long time to solve someone help me code: package projeto_leitura; import…
-
-4
votes1
answer49
viewsHow to break line after a specific line? PYTHON
My first question here, guys, I need to add a line break before he writes for1 again, as I do in this code? And I would also like for7 to be the last to be printed, as in the original file it comes…
-
-5
votes4
answers2193
viewsHow do I search a value within a String?
I created a EditText for the user to enter a value, and as soon as they click the search button on String the value entered by him, but I would like to know how to search some value within the…
-
-5
votes1
answer835
viewsFunction that converts string to lowercase and compares
struct registro{ /*Estrutura para guardar os dados do usuário*/ char usuario[50]; }atual[1000], *ptr; main() { int v = 0; verific = 0; //posicao e variavel para comp. de string volta_usuario:…
-
-5
votes2
answers204
viewsHow to save an array of chars in a variable?
I’m doing an encryption program, starting to reverse the string with the following code: namespace APS { class Program { public static void Main(string[] args) { string frase;…