11//
22// ByteOrderMark.swift
33// swift-textfile • https://github.com/orchetect/swift-textfile
4- // © 2018-2025 Steffan Andrews • Licensed under MIT License
4+ // © 2018-2026 Steffan Andrews • Licensed under MIT License
55//
66
77#if canImport(Darwin)
@@ -49,23 +49,23 @@ extension ByteOrderMark: Sendable { }
4949extension ByteOrderMark : CustomStringConvertible {
5050 public var description : String {
5151 switch self {
52- case . utf8: return " UTF-8 "
53- case . utf16BigEndian: return " UTF-16 (BE) "
54- case . utf16LittleEndian: return " UTF-16 (LE) "
55- case . utf32BigEndian: return " UTF-32 (BE) "
56- case . utf32LittleEndian: return " UTF-32 (LE) "
52+ case . utf8: " UTF-8 "
53+ case . utf16BigEndian: " UTF-16 (BE) "
54+ case . utf16LittleEndian: " UTF-16 (LE) "
55+ case . utf32BigEndian: " UTF-32 (BE) "
56+ case . utf32LittleEndian: " UTF-32 (LE) "
5757 }
5858 }
5959}
6060
6161extension ByteOrderMark : CustomDebugStringConvertible {
6262 public var debugDescription : String {
6363 switch self {
64- case . utf8: return " utf8 "
65- case . utf16BigEndian: return " utf16BigEndian "
66- case . utf16LittleEndian: return " utf16LittleEndian "
67- case . utf32BigEndian: return " utf32BigEndian "
68- case . utf32LittleEndian: return " utf32LittleEndian "
64+ case . utf8: " utf8 "
65+ case . utf16BigEndian: " utf16BigEndian "
66+ case . utf16LittleEndian: " utf16LittleEndian "
67+ case . utf32BigEndian: " utf32BigEndian "
68+ case . utf32LittleEndian: " utf32LittleEndian "
6969 }
7070 }
7171}
@@ -76,22 +76,22 @@ extension ByteOrderMark {
7676 /// String containing the raw code points that correspond to the byte order mark.
7777 public var string : String {
7878 switch self {
79- case . utf8: return " \u{EF} \u{BB} \u{BF} "
80- case . utf16BigEndian: return " \u{FE} \u{FF} "
81- case . utf16LittleEndian: return " \u{FF} \u{FE} "
82- case . utf32BigEndian: return " \u{00} \u{00} \u{FE} \u{FF} "
83- case . utf32LittleEndian: return " \u{FF} \u{FE} \u{00} \u{00} "
79+ case . utf8: " \u{EF} \u{BB} \u{BF} "
80+ case . utf16BigEndian: " \u{FE} \u{FF} "
81+ case . utf16LittleEndian: " \u{FF} \u{FE} "
82+ case . utf32BigEndian: " \u{00} \u{00} \u{FE} \u{FF} "
83+ case . utf32LittleEndian: " \u{FF} \u{FE} \u{00} \u{00} "
8484 }
8585 }
8686
8787 /// Byte array containing the raw code points that correspond to the byte order mark.
8888 public var bytes : [ UInt8 ] {
8989 switch self {
90- case . utf8: return [ 0xEF , 0xBB , 0xBF ]
91- case . utf16BigEndian: return [ 0xFE , 0xFF ]
92- case . utf16LittleEndian: return [ 0xFF , 0xFE ]
93- case . utf32BigEndian: return [ 0x00 , 0x00 , 0xFE , 0xFF ]
94- case . utf32LittleEndian: return [ 0xFF , 0xFE , 0x00 , 0x00 ]
90+ case . utf8: [ 0xEF , 0xBB , 0xBF ]
91+ case . utf16BigEndian: [ 0xFE , 0xFF ]
92+ case . utf16LittleEndian: [ 0xFF , 0xFE ]
93+ case . utf32BigEndian: [ 0x00 , 0x00 , 0xFE , 0xFF ]
94+ case . utf32LittleEndian: [ 0xFF , 0xFE , 0x00 , 0x00 ]
9595 }
9696 }
9797
0 commit comments