From 3f725c75b1327059759051845db567cf66434e34 Mon Sep 17 00:00:00 2001 From: Ilya Puchka Date: Thu, 27 Sep 2018 09:54:51 +0100 Subject: [PATCH] do not use force unwrap --- Sources/Tokenizer.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Tokenizer.swift b/Sources/Tokenizer.swift index 062388ac..cd93cb8c 100644 --- a/Sources/Tokenizer.swift +++ b/Sources/Tokenizer.swift @@ -18,11 +18,11 @@ extension String { } else if specialCharacters.contains(word) { components[components.count-1] += word } else if word != "(" && word.hasPrefix("(") || word != ")" && word.hasPrefix(")") { - components.append(String(word.first!)) + components.append(String(word[0])) appendWord(String(word.dropFirst())) } else if word != "(" && word.hasSuffix("(") || word != ")" && word.hasSuffix(")") { appendWord(String(word.dropLast())) - components.append(String(word.last!)) + components.append(String(word.suffix(1))) } else { components.append(word) }