strings.RuneCount

strings.CountRunes 函數不同,該函數排除空白符,strings.RuneCount 計算字串中每個符元的數量。

{{ "Hello, 世界" | strings.RuneCount }} → 9