diff --git a/WordPressShared/Core/Utility/String+Helpers.swift b/WordPressShared/Core/Utility/String+Helpers.swift index 9c30a37..3fde0f6 100644 --- a/WordPressShared/Core/Utility/String+Helpers.swift +++ b/WordPressShared/Core/Utility/String+Helpers.swift @@ -26,9 +26,26 @@ extension String { copy.remove(at: index) return copy } + + /// Returns a count of valid text characters. + /// - Note : This implementation is influenced by `-wordCount` in `NSString+Helpers`. + public var characterCount: Int { + var charCount = 0 + + if isEmpty == false { + let textRange = startIndex..