BinaryFormat.Text
Syntax
BinaryFormat.Text(length as any, optional encoding as nullable number) as function
About
Returns a binary format that reads a text value. The length
specifies the number of bytes to decode, or the binary format of the length that precedes the text. The optional encoding
value specifies the encoding of the text. If the encoding
is not specified, then the encoding is determined from the Unicode byte order marks. If no byte order marks are present, then TextEncoding.Utf8
is used.
Example 1
Decode two bytes as ASCII text.
Usage
let
binaryData = #binary({65, 66, 67}),
textFormat = BinaryFormat.Text(2, TextEncoding.Ascii)
in
textFormat(binaryData)
Output
"AB"
Example 2
Decode ASCII text where the length of the text in bytes appears before the text as a byte.
Usage
let
binaryData = #binary({2, 65, 66}),
textFormat = BinaryFormat.Text(
BinaryFormat.Byte,
TextEncoding.Ascii
)
in
textFormat(binaryData)
Output
"AB"
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho