Differences From Artifact [6b9d12d673]:
- File
src/OFString.m
— part of check-in
[5831626f68]
at
2018-05-13 19:24:28
on branch trunk
— platform.h: Rename OF_AMIGAOS3 to OF_AMIGAOS_M68K
The reason for this is that, in theory, this also supports versions
older than 3. (user: js, size: 67053) [annotate] [blame] [check-ins using]
To Artifact [dfa2e3781a]:
- File src/OFString.m — part of check-in [8939d24b51] at 2018-07-07 21:37:55 on branch trunk — Add -[componentsSeparatedByCharactersInSet:] (user: js, size: 68313) [annotate] [blame] [check-ins using]
︙ | |||
2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 | 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | i += delimiterLength - 1; last = i + 1; } component = [self substringWithRange: of_range(last, length - last)]; if (!skipEmpty || [component length] > 0) [array addObject: component]; [array makeImmutable]; objc_autoreleasePoolPop(pool); return array; } - (OFArray *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet { return [self componentsSeparatedByCharactersInSet: characterSet options: 0]; } - (OFArray *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet options: (int)options { OFMutableArray *array = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); bool skipEmpty = (options & OF_STRING_SKIP_EMPTY); const of_unichar_t *characters = [self characters]; size_t length = [self length]; bool (*characterIsMember)(id, SEL, of_unichar_t) = (bool (*)(id, SEL, of_unichar_t))[characterSet methodForSelector: @selector(characterIsMember:)]; size_t last; last = 0; for (size_t i = 0; i < length; i++) { if (characterIsMember(characterSet, @selector(characterIsMember:), characters[i])) { if (!skipEmpty || i != last) { OFString *component = [self substringWithRange: of_range(last, i - last)]; [array addObject: component]; } last = i + 1; } } if (!skipEmpty || length != last) { OFString *component = [self substringWithRange: of_range(last, length - last)]; [array addObject: component]; } [array makeImmutable]; objc_autoreleasePoolPop(pool); return array; } |
︙ |