Skip to content
This repository was archived by the owner on Dec 29, 2018. It is now read-only.

Commit ba4786d

Browse files
committed
eliminate forced unwrap when finding localized decimal mark
1 parent 73048b6 commit ba4786d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

CommandLineKit/StringExtensions.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ internal extension String {
2828
*/
2929
private func _localDecimalPoint() -> Character {
3030
let locale = localeconv()
31-
if locale != nil {
32-
if let decimalPoint = locale?.pointee.decimal_point {
33-
return Character(UnicodeScalar(UInt32(decimalPoint.pointee))!)
34-
}
31+
if let decimalPoint = locale?.pointee.decimal_point {
32+
return Character(UnicodeScalar(UInt8(bitPattern: decimalPoint.pointee)))
3533
}
3634

3735
return "."

0 commit comments

Comments
 (0)