ios - Delete Several Substrings from a String in Objective-C, given Ranges of each Substring -


this can considered follow-up question this question how 'delete substring given nsrange'.

let's have long string, , delete few characters location 'a', few location 'b', few location 'c' , on.

if single location , range, have used like:

nsstring *result = [basestring stringbyreplacingcharactersinrange:range withstring:@""]; 

in case of several locations , ranges, can use loop. inconvenient because have change every other range string size @ every iteration of deleting something.

is there simpler way in single iteration?

you can delete substrings end of string begin. first delete "c" after "b" , "a". in case don't need recalculate range of remaining substrings.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -