How to delete current characters in a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to delete current characters in a string?

I want to remove the characters in string and let the user to reenter it

24th Jul 2019, 3:03 PM
Smartbeard
Smartbeard - avatar
3 Answers
+ 3
Char *str = "sometaxt"; You can deal with char as array so you can say str[5]='e';
24th Jul 2019, 3:29 PM
joseph makram
joseph makram - avatar
+ 2
Reinitialize it to an empty string "'' ☺️
25th Jul 2019, 2:33 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
var name = "john"; clearButton.onclick = function(){ name = ""; } Simple, change value as empty string
24th Jul 2019, 3:25 PM
Mark Aerol Tomarse
Mark Aerol Tomarse - avatar