+ 1
what to do now if i wanted to remove specefic character from s string ?
https://code.sololearn.com/cGIxL9sKW3LE/?ref=app an example would be nice
20 Answers
+ 1
Check this edited code which removes everything except cap's letters. you can change it to accept or avoid other ASCII also.
Hope help full.
https://code.sololearn.com/cS8ploMplotw/?ref=app
0
https://www.sololearn.com/discuss/212413/?ref=app
0
Samsil Arefeen what to do with my code?
0
.I don't know about much string .I use char array for that but can do like that
https://code.sololearn.com/cCJ4PM1QUe3z/?ref=app
you don't have to use another string.
0
Samsil Arefeen that actually helps. but what if i wanted to remove a whole bunch of specefic characteres?
0
I modified my code please have a look and don't forget to give a '\0'in the last of char arr. Otherwise strlen function won't work.
0
write the specific charter in the char arr.
0
Samsil Arefeen can we use ascii in here ? lets say we want to only use letters which ascii value is 065-122.
0
yes of course.
0
can u give me an example?.I started a few months ago. after completing c++ course, i started try to do challenges and found out i dont know most other thing. there is no good video in youtube about this concept either.
0
https://code.sololearn.com/c0J0Y6uxYYQz/?ref=app
example with char array.
0
Samsil Arefeen thanks. that helps. but what is strln? anyway need to do more research on web. but enough for today
0
strlen()is a function that measures the length of the array
0
mean string
0
naresh thanks but what is this variable named size_t?
0
Zihan Sabah size_t is unsigned long which is also a primitive data type.
0
naresh also
newstr.push_back(str[i])
in this line what did u do?
0
Zihan Sabah push_back is a member function of string class here, where newstr.push_back(char) which append / adds that particular character to the end of the string every time this function called.
0
@naresh thanks
0
Just write it again and it will show the last string which you wrote