如何测试鱼壳中是否存在子串?例如,在switch
表达式中:
set myvar "a long test string"
switch $myvar
case magical-operator-here "test string"
echo 'yep!'
case '*'
echo 'nope!'
end
答案 0 :(得分:13)
set myvar "a long test string"
switch $myvar
case "*test string"
echo 'yep!'
case '*'
echo 'nope!'
end
是通配符,所以
*
如果您希望使用该字符串测试结束。如果它也可以出现在中间的某个位置,请在末尾添加另一个string
。
此外,自2.3.0以来,fish已内置match
子string match -q -- "*test string" $myvar
子命令,因此您也可以使用In [62]: image = cv2.imread(file, -1)
In [63]: image.dtype
Out[63]: dtype('uint8')
In [64]: image.shape
Out[64]: (1280, 960, 3) # 3 channels of uint8
In [76]: image.size
Out[76]: 3686400
===========================================
In [65]: image = cv2.imread(file, 0)
In [66]: image.dtype
Out[66]: dtype('uint8')
In [67]: image.shape
Out[67]: (1280, 960) # one channel of uint8
In [74]: image.size
Out[74]: 1228800
===========================================
In [69]: image = cv2.imread(file, 1)
In [70]: image.dtype
Out[70]: dtype('uint8')
In [71]: image.shape
Out[71]: (1280, 960, 3) # 3 channels of uint8
In [72]: image.size
Out[72]: 3686400
。它还支持带有“-r”选项的pcre样式的正则表达式。