Questions tagged as 'string'

2
answers

String of characters within the scanf. Why and how does scanf works ("Day% d", & day);

Problem I was making a code that would be to read a string and then an integer value: int dia, h, m, s; char dp; //Dois pontos. scanf("Dia %d",&dia); //Inicio do evento. ... I thought about creating a string for the us...
asked by 13.10.2014 / 13:00
3
answers

Split to separate part of a string considers first separator

I have the following text:    _2910_0908_401 _600_ERV__P_119552_GUARITA ERV WITHOUT ENERGY RADIO INOPERAN_TE SEMAFOROS P TRENS AND VEICLS OFF_PSG TREM C FLAG SIGN BY GUAR_ITA I use Split to break every "_" itens = this.Entidade...
asked by 29.10.2014 / 13:39
2
answers

Is there a function that fills a string up to a certain length?

I would like to populate a string until it reaches a certain length. Is there a function that can do this? It would look something like PadLeft(Int32,Char) and <     
asked by 19.07.2017 / 16:48
3
answers

Limit size of a String?

I declare char pl1[10], pl2[10]; And I did the following: printf("Nome do Player1: "); scanf("%10s", &pl1); printf("Nome do Player2: "); scanf("%10s", &pl2); Thinking he would read only the first 10 characters that the user typ...
asked by 12.06.2015 / 16:31
1
answer

Format CPF or CNPJ field using Regex [duplicate]

I would like a regular expression (REGEX) to format the CPF or CNPJ field This is the code I've come so far: String cpf ="09551130401"; cpf = cpf.replaceAll("(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})", "$1.$2.$3-$4"); System.out.pri...
asked by 07.06.2016 / 13:58
3
answers

"Carrying" variables between functions, does strange character appear in place?

In the main fault function when I print a char , it appears a strange code resembling a hex: But when I print the same char in another function it appears normal. char tempA[100] = "1111"; int main () { strcpy(tempA , "1...
asked by 16.09.2016 / 15:04
3
answers

Format Field C #

I know the 'N' and 'C' formations of C #, but they do not answer me. I get 1000 of the database and would like it to format for 1.000 . What I put in .ToString("???")     
asked by 07.06.2017 / 17:59
2
answers

Find a snippet of an HTML

I get a string , and it contains an HTML. Here is a table, and its columns: <td width="24%" valign="top" border="1" style=" BORDER-RIGHT: windowtext 0.5pt solid; BORDER-TOP: windowtext 0.5pt solid; BORDER-LEFT...
asked by 10.11.2014 / 15:31
1
answer

When to use String and StringBuilder [duplicate]

There is another question about What is the most appropriate way to concatenate strings? . It explains the possible types of concatenations in C# . But when should we use System.String and when should we use System.Text.Str...
asked by 29.08.2017 / 10:58
3
answers

Is it possible to add int with str composed of text and numbers in Python?

I asked this question And in the case of python ? I can convert the string '1' str to 1 int . Example: 1 + int('1') # Imprime: 2 However, if I try to convert '1 cachorro' str to int ... int('1 c...
asked by 21.08.2015 / 18:46