相較於 strings.RuneCount 函式,strings.CountRunes 排除了空白的情況下,計算字元數量。
strings.RuneCount
strings.CountRunes
{{ "Hello, 世界" | strings.CountRunes }} → 8