0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

文字のバイト数を数える試み~その2 |Power Query

Posted at

以前、ワークシート関数のLENBの再現に挑戦したけれど、まともそうな方法があることに気づいたので、改めて投稿します。
文字のバイト数を数える試み |Power Query

##コード
たったこれだけです。:sweat:
コード中の932はエンコードのShift-JISを指しているので、これもまた日本語環境を前提にした関数ということになります。

fx_LENB
(TargetText as text)=>
let
    bin = Text.ToBinary(TargetText,932),
    length = Binary.Length(bin)
in
    length

##実験結果
ワークシート関数と結果が一致してますね。

image.png
image.png

##参考
Binary.Length - PowerQuery M - Microsoft Docs
Text.ToBinary - PowerQuery M - Microsoft Docs

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?