From a2fcdf834be3084e33ce42db9174d5eb020fbfe4 Mon Sep 17 00:00:00 2001 From: iska Date: Sat, 7 Mar 2015 00:43:00 +0100 Subject: [PATCH] Add character token method to split it from a given index --- HTMLKit/HTMLCharacterToken.h | 1 + HTMLKit/HTMLCharacterToken.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/HTMLKit/HTMLCharacterToken.h b/HTMLKit/HTMLCharacterToken.h index 56ad1ad..be3d4ee 100644 --- a/HTMLKit/HTMLCharacterToken.h +++ b/HTMLKit/HTMLCharacterToken.h @@ -20,5 +20,6 @@ - (BOOL)isWhitespaceToken; - (HTMLCharacterToken *)tokenByRetainingLeadingWhitespace; - (HTMLCharacterToken *)tokenByTrimmingLeadingWhitespace; +- (HTMLCharacterToken *)tokenByTrimmingFormIndex:(NSUInteger)index; @end diff --git a/HTMLKit/HTMLCharacterToken.m b/HTMLKit/HTMLCharacterToken.m index 257fb2e..2548558 100644 --- a/HTMLKit/HTMLCharacterToken.m +++ b/HTMLKit/HTMLCharacterToken.m @@ -59,6 +59,11 @@ return nil; } +- (HTMLCharacterToken *)tokenByTrimmingFormIndex:(NSUInteger)index +{ + return [[HTMLCharacterToken alloc] initWithString:[_characters substringFromIndex:index]]; +} + #pragma mark - NSObject - (BOOL)isEqual:(id)other