Questions tagged as 'string'

2
answers

How to separate a string into pieces?

In other languages there is split , explode or something similar that chucks string into chunks according to some separator. Is there something C ready or do I have to do on hand?     
asked by 17.03.2017 / 12:20
5
answers

How to concatenate String within a loop of repetition?

I need to add some values in a string . How do I concatenate values in a string with a loop of repetition. Example: for($c=0; $c < $tam; $c++){ //concatenar sempre o valor $minhastring = $valor[$c].','; } That is, I need...
asked by 22.09.2015 / 13:43
1
answer

What is the difference between puts () and fputs ()?

I know that both functions are for displaying strings on the screen. But what is the difference between them? Which one is best to use?     
asked by 12.09.2014 / 18:14
3
answers

Remove spaces from a string from the second occurrence

I'm currently removing spaces using a simple replace() and adding a space that I must preserve between the third and fourth character using substr() let str = 'abc defghijk lmnop qrstuv wx y z' str = str.replace(/\s+/g, ''...
asked by 27.07.2018 / 16:34
2
answers

Is it possible to access the same argument twice in sprintf?

In PHP time the function sprintf . With it we can format the values sequentially passed from the second parameter. For example: sprintf('Meu nome é %s e tenho %d anos de idade', 'Wallace', '26') The output will be    My name is...
asked by 08.07.2016 / 18:33
3
answers

Reverse a 3-digit number in C

I need to make a program that the user type a three-digit number and the program reverses that number for example 123 -> 321 , I would like to know the logic to do this, because I can not think of anything.     
asked by 15.10.2014 / 19:48
4
answers

How to split a string every 2 characters?

I'm trying to split a string every two characters, but I do not have a delimiter and need to use the entire string. Example: String exemplo= 99E65A78 String ex1= 99 String ex2= E6 String ex3= 5A String ex4= 78     
asked by 22.11.2017 / 12:38
2
answers

Replace letter by empty or blank, something like Replace ("letters", "")

There is a A1_ZTEL field in the database that is varchar(15) . This way, each user entered a record of all forms, with bar, dot, comma and letter. Now I need to mount a form and read this field from another table that is var...
asked by 11.04.2018 / 21:47
3
answers

TypeError: not all arguments converted during string formatting (Python 3.4)

I'm new to programming and trying to make a simple exercise code to calculate a phone bill: t = float(input('Digite a quantidade de minutos gasta: ')) if t < 200: p = t * 0,2 if t >= 200 and t < 400: p = t * 0,18 if t >= 4...
asked by 22.02.2015 / 13:23
2
answers

Verify that the string is null or empty

How do I check if my variable is empty or null? // Inserção Nome = tf_Nome.getText().toString(); Tipo = tf_Tipo.getText().toString(); Estoque = Integer.valueOf(tf_Estoque.getText().toString()); Preco = Double.valueOf(tf_Preco.getText(...
asked by 08.10.2014 / 18:46