0

How would I replace every occurrence of a letter expect for the frist and last ones in a string?

23rd Oct 2019, 9:54 PM
Bobby Ma
13 Réponses
24th Oct 2019, 11:25 AM
id001x
id001x - avatar
+ 2
Some like this, but as you can see it need more conditions... https://code.sololearn.com/cTwgUHBtGJlR/?ref=app
24th Oct 2019, 10:11 AM
id001x
id001x - avatar
+ 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/
24th Oct 2019, 9:06 AM
id001x
id001x - avatar
+ 1
what is conditions for replacing?
24th Oct 2019, 9:13 AM
id001x
id001x - avatar
+ 1
Can you give more concrete example?
24th Oct 2019, 10:19 AM
id001x
id001x - avatar
+ 1
Welcome 🙃
24th Oct 2019, 5:32 PM
id001x
id001x - avatar
0
Don't really know what u mean but I would assume the answer is there isn't any
24th Oct 2019, 9:15 AM
Bobby Ma
0
My bad I think I did the example wrong. It's just suppose to be the letter h.
24th Oct 2019, 10:16 AM
Bobby Ma
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
24th Oct 2019, 10:21 AM
Bobby Ma
0
Thank you much appreciated
24th Oct 2019, 5:31 PM
Bobby Ma
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.
24th Oct 2019, 5:42 PM
Noman Nasir
Noman Nasir - avatar
0
What is pythen stand for
25th Oct 2019, 3:24 PM
Gaming machine sushant
- 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
24th Oct 2019, 9:09 AM
Bobby Ma