gpt4 book ai didi

linux - 如何计算 Bash 中字符串中的单词数

转载 作者:太空狗 更新时间:2023-10-29 11:24:04 25 4
gpt4 key购买 nike

<分区>

我有以下字符串,其中包含由空格分隔的单词

str="word1 word2 word3"

如何统计字数?

我不想使用带计数器的 for 循环。我想用一条命令完成。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com