Equivalent to test -n $str
2024-01-16
fish
softwares-and-tools
string
string length 'hello, world'
12set str foostring length -q $str; echo $status
0Equivalent to test -n $strstring length --visible (set_color red)foobarthe set_color is discounted, so this is the width of "foobar"6string length --visible 🐟🐟🐟🐟depending on $fish_emoji_width, this is either 4 or 8in new terminals it should be8string length --visible abcdef\r123this displays as "123def", so the width is 66string length --visible a\nbccounts "a" and "bc" as separate lines, so it prints width for each1
2不接收参数不会输出(不是输出 0