Is there anyway to strip or replace or anything like that from one index to another index within a single string?
For example, if I have a string like “first – second – third” and I want to remove the middle part (” – second – “), how could I do this?
Thanks in advance.
Your string:
and the possible solutions:
or
or
or if you know the indices:
or just searching for the first and last space:
all of them return
'firstthird'