Azure Kusto查询语言拆分@字符并获取最后一项

Azure Kusto查询语言拆分@字符并获取最后一项,azure,azure-data-explorer,Azure,Azure Data Explorer,例如,如果我有一个字符串: “这是.a.string.and.I.need.the.last.part” 我试图在最后一个“.”之后获取字符串的最后一部分,在本例中是“part” 我如何做到这一点? 我尝试的一种方法是在“.”上拆分字符串,我得到一个数组,但是我不知道如何检索数组中的最后一项 | extend ToSplitstring = split("this.is.a.string.and.I.need.the.last.part", ".")

例如,如果我有一个字符串: “这是.a.string.and.I.need.the.last.part” 我试图在最后一个“.”之后获取字符串的最后一部分,在本例中是“part” 我如何做到这一点? 我尝试的一种方法是在“.”上拆分字符串,我得到一个数组,但是我不知道如何检索数组中的最后一项

| extend ToSplitstring = split("this.is.a.string.and.I.need.the.last.part", ".") 
给我:

["this", "is","a","string","and","I","need","the","last", "part"]
第二次,我试过:

| extend ToSubstring = substring(myString, lastindexof(myString, ".")+1)
但是Kusto没有lastindexof的函数


任何有提示的人?

您可以尝试下面的代码,并根据需要随意更改:

let lastIndexof = (input:string, lookup: string) {
    indexof(input, lookup, 0, -1, countof(input,lookup))
};
your_table_name 
| extend ToSubstring = substring("this.is.a.string.and.I.need.the.last.part", lastIndexof("this.is.a.string.and.I.need.the.last.part", ".")+1)

您可以使用负索引
-1
访问数组的最后一个成员

e、 g.这:

打印拆分(“this.is.a.string.and.I.need.the.last.part”,”)[-1]


返回一个表,其中包含一列和一条记录,其值
part

非常简单,非常重要。现在我感觉很糟糕。非常感谢。