计算多个文本字符串的出现次数

时间:2019-10-31 18:27:14

标签: powerquery m

我想知道文本字符串中是否存在文本,但是我想测试多个文本。例如,尝试查找

中是否存在dog OR lazy

“敏捷的棕色狐狸跳过了懒狗,而懒狗没有注意到”

尝试过 让     String =“快速的棕色狐狸跳过了懒狗,而懒狗没有注意到,”,     Count = List.Count(Text.Split(String,“ dog”,“ lazy”))-1 在     计数

本文Is there a simple way to count occurences of one text string within another text string?

如果狗或懒狗存在于

“敏捷的棕色狐狸跳过了懒狗,而懒狗没有注意到”

希望是或1

1 个答案:

答案 0 :(得分:0)

Text.Split不带两个参数

请参见https://docs.microsoft.com/en-us/powerquery-m/text-split

尝试

Count = List.Count(Text.Split(String,"dog")) + List.Count(Text.Split(String,"lazy"))-2