跳轉到內容

Rebol 程式設計/utf?

來自華夏公益教科書,自由的教學讀物
UTF? data 

從 BOM(位元組順序標記)返回 UTF 編碼:+ 表示 BE;- 表示 LE。

UTF? 是一個函式值。

  • data -- (型別:二進位制)

原始碼

[編輯 | 編輯原始碼]
utf?: func [
    {Returns the UTF encoding from the BOM (byte order marker): + for BE; - for LE.} 
    data [binary!]
][
    parse/all/case data [
        #{EFBBBF} (return 8) | 
        #{0000FEFF} (return 32) | 
        #{FFFE0000} (return -32) | 
        #{FEFF} (return 16) | 
        #{FFFE} (return -16) | 
        (return 0)
    ]
]
華夏公益教科書