0
How would I replace every occurrence of a letter expect for the frist and last ones in a string?
13 Antworten
+ 2
Some like this, but as you can see it need more conditions...
https://code.sololearn.com/cTwgUHBtGJlR/?ref=app
+ 1
Can you give example ? You can use "string".replace method
https://www.google.com/amp/s/www.geeksforgeeks.org/c-sharp-replace-method/amp/
+ 1
what is conditions for replacing?
+ 1
Can you give more concrete example?
+ 1
Welcome 🙃
0
Don't really know what u mean but I would assume the answer is there isn't any
0
My bad I think I did the example wrong. It's just suppose to be the letter h.
0
Say the string was a a a a
The out put would be
a A A a
The first and last of that letter is not changed
0
Thank you much appreciated
0
Take a variable to see if first occurence has passed or not to monitor the change in first occurence also save the index of last occurrence. Once u exit the loop change the last occurrence back to original.
0
What is pythen stand for
- 2
Example input
In the hole there was three rabbits
Example output
In the Hole tHere was three rabbits
The letter here would be h