Skip to contents

KIT 的程式碼範例與說明一行最多約 70 欄:英文字母、數字、符號算 1 欄, 中文字(與其他全形字)算 2 欄。

Usage

kit_code_cols(x)

Arguments

x

字串向量(一個元素一行)。

Value

整數向量:每一行幾欄。

See also

Examples

kit_code_cols(c("abc", "讀 CSV", ""))
#> [1] 3 6 0
# 哪幾行超過 70 欄
lines <- c("x <- 1", strrep("中", 36))
which(kit_code_cols(lines) > 70)
#> [1] 2