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
votes4
answers1011
viewsReplace a string’s letters with their respective alphabet position
I need to replace each letter of any string with its position in the alphabet. For example, the string "faebcd" must become "615234". I’m stuck at the replace values part of the array novaFrase by…
-
1
votes2
answers64
viewsHow to copy a string in C?
The following method I found on the internet, serves to create a string copy.: char* bin_copy_string(const char* begin, const char* end) { char* result; result = malloc(end - begin); if (result) {…
-
1
votes1
answer325
viewsRemove space from a php string
I have a problem with an appointment SQL on the basis of a array. I am concatenating the values received from a text-area, by sql with a IN, follows sql example: select * from jupiter where imei in…
-
1
votes1
answer212
viewsHow to write a string variable without breaking the line?
I need to write only in the first line of a file, but whenever I add a string type variable this line is broken, follow the example: #include <stdio.h> #include <string.h> char…
-
1
votes1
answer100
viewsInput with fgets
Hello, I’m having the following difficulty, the moment I call the function of fgets, regardless of whether on any parole, or in the registration function it does not work. At the moment when…
-
1
votes1
answer154
viewsPrint the letters in front of the alphabet
The idea of the code was to enter a letter, for example 'a' and return a letter in front of the alphabet, in this case the letter 'b', but the program does not return anything and I can not find the…
-
1
votes1
answer38
viewsError printing variables of a class object in code
When executing the code ends up returning me the following: Oi, meu nome é Instance of 'Pessoa'.nome, tenho Instance of 'Pessoa'.idade anos e meu pseudônimo é Instance of 'Pessoa'.pseudonimo. The…
-
1
votes0
answers89
viewsSelecting text from an HTML element
I’m trying to copy a text from an HTML element, it’s a code that turns the first letters of the words into uppercase (and the "da,da,dos" into lowercase) and I’m trying to implement this copy…
-
1
votes1
answer726
viewsHow to not count the "spaces" of a sentence in python
I wonder how to count only the typed letters without space. Even with the strip it counts the spaces. nomed = nome.split() numdi = len(nomed[0]) print('O seu nome tem letras {} e o seu primeiro nome…
-
1
votes1
answer90
viewsInvert string containing numbers
Using this code as a test, whose goal is to invert a string containing numbers. Input: 0123456789 Output: [57, 56, 55, 54, 53, 52, 51, 50, 49, 48] unlike [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]. public class…
-
1
votes1
answer33
viewsIn Python E Jupyter Notebook, how to present a full screen record?
I’m at Jupyter Notebook working with Python. My columns are strings and very long, I need to see these complete on screen, how to do this? The image of the dataframe with the "incomplete strings":…
-
1
votes2
answers87
viewsHow to define which inputs will be accepted by the code?
I have a code where as the user enters data, I want to create a list that will be used for operations later. Output input would be the key "f" interrupting the repeat structure and initiating…
-
1
votes1
answer179
viewsHow to search for a substring from an offset in Rust?
How to find the index of the beginning of a substring starting from a given index of string? In C++, for example, the method std::string::find accepts a offset or index where the search should…
-
1
votes1
answer442
viewsSet decimal numbers in a string list - Python
I hope you can help me! I am on a project where I am creating some Graphics for a system that is used by people from various countries. Because of this, I created a function called formatC that,…
-
1
votes1
answer75
viewsSplit String into blocks, considering only letters or text in square brackets
If I have a string like that: "Olá, o meu nome é [José Cavalo]" And I der split: {"Olá,", "o", "meu", "nome", "é", "[José", "Cavalo]"} First of all, we have a problem. At 0, we have "Olá,", and we…
-
1
votes1
answer88
viewsPython script that generates a main diagonal character square
I am trying to make a program that given a value, generates a "square" of n rows and n columns that has characters : in the main diagonal positions and the characters + in other positions. For…
-
1
votes2
answers64
viewsstr_replace_all - how to find words by the first 3 letters of a string?
I have the following structure: library(stringr) filtro_palavras <- structure(list(palavras = c("cultivo", "produtos", "atacadista", "papel", "madeira", "água", "agrícola", "vestuário",…
-
1
votes1
answer36
viewsHow to remove null decimal part (00) of Javascript number formatting?
I intend in Javascript to have the following result: Entree Expected exit 1.6 1,60€ 1 1€ 1.55 1,55€ I’ve tried to: num.toLocaleString('pt-PT', { minimumFractionDigits: 0, maximumFractionDigits: 2 })…
-
1
votes2
answers619
viewsModifying a Python file without losing the current content
That doubt is a continuation of this here. I have a very large TXT file (about 6GB), each line being 1,300 characters, and I am manipulating these lines, as an example, I will use these three lines…
-
1
votes1
answer298
viewsHow to return a tuple to a function in Haskell?
I started messing with Haskell because of some college activity, and I’m having doubts about what the error in my code might be. The program will have two functions. 'tam', which will return the…
-
1
votes1
answer57
viewsLetter to lowercase conversion gives a numerical result
Which part of this code C++ I’m missing where I need to convert a whole word to lowercase? #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string>…
-
1
votes4
answers97
viewsFind a ( string ) value in a PHP array
I’m having trouble finding a variable value inside an array Example: I have the information below in some array. $dadosCli1 = array("cep:'000000'", "cidade: 'sao paulo'", "rg: '00.000.000.-00'",…
-
1
votes1
answer117
viewsHow to extract a word from a string (SQL Server)
I’m having a problem with my script. Context: I need to get information from a string that is in the nm_content column, but all the functions I try are not working. I tried to do it separately and…
-
1
votes1
answer181
viewsHow to convert a character to its corresponding hexadecimal in the ASCII Ruby table?
I am using Ruby and have the string "AwX" in hexadecimal. I can write to the screen using the following command: puts "\x41\x77\x58" But I want to do the reverse: I have a string "AwX", but I want…
-
1
votes2
answers81
viewsHow do I replace characters from a string, right to left, cumulatively?
I’m trying to write a function that gets a String and replaces its characters from right to left, for zero. I would also like to do this cumulatively and save the changes. For example: String teste…
-
1
votes1
answer71
viewsHow to add a value key to a dictionary?
I want to add terms to an organized dictionary-like glossary, requested by an activity, but I’m getting an error message that I can’t identify why. glossario = { 'concatenar': 'Concatenar é a junção…
-
1
votes0
answers11
viewsChanging Widht and Hight of a Java text using the Graphics Class
Hello, follow my question.: As the image below would like to play something like this in Java using the Graphics Class I want to be able to scale a text with the Drawstring method, I took a look at…
-
1
votes2
answers68
viewsRegex extract substring from text delimited by an end pattern that repeats in the text (Starttextofim Starttextofim)
I aim to perform the extraction of the substring delimited by ENTER and Tempo de viagem total:4h 05m in the text below: For this I built the following regular expression: ENTER[\S\s]+Tempo de viagem…
-
1
votes0
answers27
viewsAssembly bootloader al returns empty string
I’m creating a bootloader but had a problem writing on screen I am using two files the bootloader.asm and Keyboard.asm bootloader.asm: %include "src/assembly/setings.asm" [org BOOTADD] _mode:…
-
1
votes0
answers116
viewsString chained list within a struct
Hello. I’m doing a job where I need to store words in a list that must be inside a tree struct. I don’t know why the code stops inserting in the list shortly after moving to the next key/line. The…
-
1
votes1
answer190
viewsHow to count multiple characters from a string using Python
I want to count how many basic cracks of the type ATC (for example) have in sequence seq. What I’ve done so far is: # CONTAGEM DE NUCLEOTIDEOS # CONTAGEM DE TRINCAS/CÓDONS DE UMA SEQUENCIA seq seq =…
-
1
votes1
answer31
viewsExtract only uppercase words with R
library(stringr) I am trying to extract only the uppercase words from a string. teste <- "Isto é um Teste para ver se Eu consigo capturar APENAS as Palavras TOTALMENTE Maiusculas" teste [1] "Isto…
-
1
votes2
answers177
viewsHow to find the umpteenth occurrence of a substring?
I need to do a function that takes as input a string, a letter, and a number that indicates the desired occurrence of the letter (1 for first occurrence, 2 for second, etc). The function needs to…
-
1
votes2
answers292
viewsjava.util.Illegalformatconversionexception: d != java.lang.Integer
What’s going on here? I don’t think I can read the documentation from String format.(). For me this date/time conversion %td When receiving an integer within the interval of the day of the month it…
-
1
votes1
answer45
viewsMerge columns into a single string in R
Suppose the following date.frame: df<-data.frame(V1 = c(9,1,4,2,3,0,7,9,5), V2 = c(9,2,5,4,7,9,2,3,8), V3 = c(9,8,5,7,4,0,2,9,3), V4 = c(9,7,3,6,2,9,5,8,4), V5 = c(9,2,5,4,0,3,9,4,8)) V1 V2 V3 V4…
-
1
votes2
answers65
viewsCorrect unbalanced parentheses
Given a string filled with any number of parentheses, find the minimum number of parentheses to be included in the string so that it is valid. Examples: Input "(()()" must return: 1 - "(()())" Input…
-
1
votes1
answer32
viewsHow to properly traverse a matrix allocated in C?
Whenever I walk through my char matrix (char**) it changes all positions with the value of the last node, example; char** string = AlocaMatriz(10,10); //retorna uma matriz char** 10x10 allocada char…
-
1
votes0
answers62
viewsDifference between string size in Standard C and C++
I compiled the following code in C Standard and C++: #include <stdio.h> #include <string.h> char string[5] = "hello"; int main(void) { printf("string tem %lu bytes\n", sizeof(string));…
-
1
votes1
answer128
viewsConvert lower case letter to upper case without using "toupper()"
I am working on a function to turn in capital letters, but my retouching is strange. In the end is giving the result below: Word input data: lucas Program is returning: LUCASÓÓÓÓÓÉð #include…
-
1
votes1
answer108
viewsHow to get binary code from a string without ASCII characters in Python?
I’m studying Unicode and encodings. I understand so far that Unicode is a key-value structure in which each character is represented by a number. Example: import string…
-
1
votes0
answers25
viewsRelate String matrix to a Float vector in C
I need the program to receive 20 names typed by the user, store in a Char Matrix, and right after receive the 20 salary of the users and store in a Float vector. I was able to do even the part where…
-
1
votes1
answer63
viewsHow to align numbers on the left using str.format?
I’m studying about format strings and I’m not getting the same alignment behavior on the left with the minus sign (-) using the function format. What is the right way to do this using format?…
-
1
votes1
answer53
viewsRead txt file names in C
So basically the code needs to read the names of a txt file (AFTER I WILL MANIPULATE THEM) until it has the word 'end. In that part of the code where it reads the lines, it just stores the 1 string…
-
0
votes2
answers1487
viewsAccent + $http.get
I’m having trouble making an Ajax call using Angularjs because the strings that have accents are returning null, in response to the call, my PHP is returning a JSON json_encode($data), and upon…
-
0
votes2
answers799
viewsFatal error: Cannot unset string offsets
After uploading my website, the form for inserting images stopped working, when clicking the save button I get : Fatal error: Cannot unset string offsets in…
-
0
votes1
answer90
viewsProblems checking out Empty()
I’m having trouble checking a string using EMPTY(), it’s as follows. If I throw space into it " " it ceases to be empty.. and ends up inserting in the database the empty value, how can I solve this,…
-
0
votes1
answer45
viewspreg_replace_callback does not return values
That my code is not returning the values $owner and $mid in function make_user() Because? preg_replace_callback('/(^|[^a-z0-9_])M([a-z0-9_]+)/i', function($matches, $owner, $mid) { return…
-
0
votes1
answer121
viewsHow do the istreams of a string work?
To catch a std::string, type pointers are required char, as far as I know. However, to grab a pointer, you have to allocate memory (necessarily, or there will be a runtime error, one Segmentation…
-
0
votes1
answer97
viewsURL_STRING does not fill correctametne
I have a problem in the consumer class of my Webservice Rest. In the project there are only two classes, Mainactivity is working correctly, but the consumption class (Consumows) is not understanding…
-
0
votes1
answer401
viewsHow to pick words and save in a string?
How do I save words I get in a string new? gravarArq.println(token.getLexeme() + "_" + token.getPOSTag() + "_" + token.getFeatures()); How to take what comes from token.getPOSTag() and save all the…