Reputation: 33813
I have the following string:
https://example.com/get/ea34b8062cr2533eed0b4302e44d4090e26ae3c01bb1124292f3c970_1280.jpg
I want just remove the character s
from this part https
and return the whole string again but without s
character.
wxString imgURL = "https://example.com/get/ea34b8062cr2533eed0b4302e44d4090e26ae3c01bb1124292f3c970_1280.jpg";
imgURL.Remove(imgURL.find('s'));
this->m_textShowData->SetValue(imgURL);
Unfortunately, the previous code removes the s
character but doesn't return the whole string again but it returns http
only.
How to remove the character s
and then return the whole string without that character?
Upvotes: 1
Views: 286
Reputation: 1933
According to the documentation Remove() function has overload where you can specify the number of characters you want to remove from given position.
So this should do the trick:
imgURL.Remove(imgURL.find('s'), 1);
But this function is preserved only for compatibility reasons and as the documentaion mentions, it should not be used in new code. Take a look at erase() function instead, which has the same syntax as Remove()
Upvotes: 0