Skip to content

Commit

Permalink
Fix unicodeArray (SwifterSwift#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
omaralbeik authored and LucianoPAlmeida committed Aug 14, 2018
1 parent 6f2c9fb commit fb19497
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The changelog for **SwifterSwift**. Also see the [releases](https://github.com/S
- Fixed `scaled(toWidth:, with orientation:)` and `scaled(toHeight:, with orientation:)` were using image's scale as the scale factor. [#515](https://github.com/SwifterSwift/SwifterSwift/pull/515) by [VincentSit](https://github.com/VincentSit).
- **String**:
- Used [RFC 5322](http://emailregex.com/) in `isValidEmail`, an email address regex that 99.99% works. [#517](https://github.com/SwifterSwift/SwifterSwift/pull/517) by [Omar Albeik](https://github.com/omaralbeik)
- Fixed `unicodeArray()` not returning the correct unicode value due to Swift 4.2 new hashing system. [#544](https://github.com/SwifterSwift/SwifterSwift/pull/544) by [Omar Albeik](https://github.com/omaralbeik)

### Deprecated
- **String**:
Expand Down
4 changes: 2 additions & 2 deletions Sources/Extensions/SwiftStdlib/StringExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,11 @@ public extension String {

/// SwifterSwift: Array with unicodes for all characters in a string.
///
/// "SwifterSwift".unicodeArray -> [83, 119, 105, 102, 116, 101, 114, 83, 119, 105, 102, 116]
/// "SwifterSwift".unicodeArray() -> [83, 119, 105, 102, 116, 101, 114, 83, 119, 105, 102, 116]
///
/// - Returns: The unicodes for all characters in a string.
public func unicodeArray() -> [Int] {
return unicodeScalars.map { $0.hashValue }
return unicodeScalars.map { Int($0.value) }
}

#if canImport(Foundation)
Expand Down

0 comments on commit fb19497

Please sign in to comment.