c - Change more than one space in between words into one -
c - Change more than one space in between words into one -
i need read text , find if there more 1 space between words.
if there alter one.
for illustration if have text:
my name lukas
program should alter to:
my name lukas
any ideas?
j = 0; for(i=0; mystr[i] != '\0'; i++) { if(mystr[i] == ' ' && mystr[i+1] == ' ') continue; newstr[j] = mystr[i]; j++; }
and don't forget add together '\0'
(which indicates end of string) end of newstr
c
Comments
Post a Comment