Erlang - byte_size



此方法返回位元串中包含的位元組數。

語法

byte_size(bitstring)

引數

  • 位元串 - 這是需要確定位元組數的位元串。

返回值

該方法返回位元串中包含的位元組數。

例如

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[byte_size(<<1,2,3>>)]).

輸出

當我們執行上述程式時,我們將得到以下結果。

3
erlang_bifs.htm
廣告

© . All rights reserved.