How to get all characters after the last '/' (slash) from url string?
I receive a json string from my URL scheme when making webview request for certain site. For example:
NSRange lastDotRange = [sURL rangeOfString:@"/" options:NSBackwardsSearch];
Well it seems like using Regex is quite expensive inside shouldStartLoadWithRequest delegate especially if you're having hybrid app which has plenty webviews. Some of my websites in webview might have more than one request, some are running at the background. It's painful if the webview triggers regex codes everytime when webview loads the request.
And also, I have escaped '/' in my last component params (json string), it might cause the lastComponent breaks after the escaped '/' character.
Therefore I stick to the codes filtering by using if-else statements and also compare strings with components of URL For example
request.URL.absoluteString request.URL.host request.URL.fragment
and also found out that @Nitin Gohel is useful.