Please help! How would i find and remove leading underscores by iterating through looking at the characters and counting the number of underscores before a valid character occurs. As well as iterating backwards from the end of the string to find any trailing underscores.
I can use the following method, to erase the underscore, but how would is iterate to find underscores.
resultF.erase(resultF.length()- trailingCount);
resultF.erase(0,leadingCount);
If user enters a string of ___twenty_three__, the end result should be twenty_three. So only the leading and trailing underscore are deleted.
No comments:
Post a Comment