Search for a string between two known strings

前端 未结 3 954
闹比i
闹比i 2021-01-03 11:48

I have a String with this content:

href=\"http://www.website.com/\" /> [...] [...]

I just want to get the central part of the string. Ho

3条回答
  •  温柔的废话
    2021-01-03 12:36

    This can be done more compactly:

    NSRange end = [source rangeOfString:@"\" />"];
    if (end.location != NSNotFound) {
        result = [source substringWithRange:NSMakeRange(6, end.location - 6)];
    }
    

提交回复
热议问题