構文
BinaryFormat.Text(length as any, optional encoding as nullable number) as function
バージョン情報
テキスト値を読み取るバイナリ形式を返します。
lengthは、デコードするバイト数、またはテキストの前の長さのバイナリ形式を指定します。 省略可能な encoding 値は、テキストのエンコードを指定します。
encodingが指定されていない場合、エンコードは Unicode バイトオーダー マークから決定されます。 バイトオーダーマークが存在しない場合は、 TextEncoding.Utf8 が使用されます。
例 1
2 バイトを ASCII テキストとしてデコードします。
使用方法
let
binaryData = #binary({65, 66, 67}),
textFormat = BinaryFormat.Text(2, TextEncoding.Ascii)
in
textFormat(binaryData)
アウトプット
"AB"
例 2
テキストの長さがバイトとしてテキストの前に表示される ASCII テキストをデコードします。
使用方法
let
binaryData = #binary({2, 65, 66}),
textFormat = BinaryFormat.Text(
BinaryFormat.Byte,
TextEncoding.Ascii
)
in
textFormat(binaryData)
アウトプット
"AB"