GitHub GitHub: 線上編輯

strlen ()

傳回輸入字串的長度 (字元)。

語法

strlen(來源)

引數

  • source: 將測量字串長度的來源字串。

退貨

傳回輸入字串的長度 (字元)。

附註:

此函數會計算 Unicode 字碼點

範例

print length = strlen("hello")

長度
5
print length = strlen("⒦⒰⒮⒯⒪")

長度
5
print strlen('Çedilla') // the first character is a grapheme cluster
                        // that requires 2 code points to represent

長度
8