@@ -90,14 +90,14 @@ public class StyleRegEx: StyleProtocol {
9090
9191 public func add( to source: AttributedString , range: NSRange ? ) -> AttributedString {
9292 if let base = self . baseStyle {
93- source. addAttributes ( base. attributes, range: ( range ?? NSMakeRange ( 0 , source. string . count ) ) )
93+ source. addAttributes ( base. attributes, range: ( range ?? NSMakeRange ( 0 , source. length ) ) )
9494 }
9595 return self . applyStyle ( to: source, add: true , range: range)
9696 }
9797
9898 public func set( to source: AttributedString , range: NSRange ? ) -> AttributedString {
9999 if let base = self . baseStyle {
100- source. setAttributes ( base. attributes, range: ( range ?? NSMakeRange ( 0 , source. string . count ) ) )
100+ source. setAttributes ( base. attributes, range: ( range ?? NSMakeRange ( 0 , source. length ) ) )
101101 }
102102 return self . applyStyle ( to: source, add: false , range: range)
103103 }
@@ -112,7 +112,7 @@ public class StyleRegEx: StyleProtocol {
112112 /// - range: range, `nil` to apply the style to entire string.
113113 /// - Returns: modified attributed string
114114 private func applyStyle( to str: AttributedString , add: Bool , range: NSRange ? ) -> AttributedString {
115- let rangeValue = ( range ?? NSMakeRange ( 0 , str. string . count ) )
115+ let rangeValue = ( range ?? NSMakeRange ( 0 , str. length ) )
116116
117117 let matchOpts = NSRegularExpression . MatchingOptions ( rawValue: 0 )
118118 self . regex. enumerateMatches ( in: str. string, options: matchOpts, range: rangeValue) {
0 commit comments