Skip to content

NSMakeRange

Nat! edited this page Mar 1, 2023 · 3 revisions

For those special moments, when you really want to do string operations in the template and you need NSRange: there is a NSMakeRange function built in.

Example

{{ [@"VfL Bochum 1848" substringWithRange:NSMakeRange( 4, 6)] }}
{# stupid pet tricks, achived by a category on NSValue #}
{{ [@"VfL Bochum 1848" rangeOfString:@"18"].location }}

Output:

Bochum
11

Clone this wiki locally