米尔街,帕尔,西开普省,南非
(Location,SectionNr) =>
let
Sections = Text.Split(Location,","),
Section = Sections[SectionNr]
in
Section
GetSection("De Villiers Street, Wellington North, Wellington, Western Cape, South Africa ",4)
...应该返回西开普
GetSection("Main Street, Paarl, Western Cape, South Africa",3)
...应该返回西开普对其进行了探测:
= (Location,SectionNr) =>
let
Sections = Text.Split(Location,","),
SectionValue = Sections{SectionNr-1}
in
SectionValue
问题是我是[]括号而不是{}括号。同样,由于列表索引从0开始,我更喜欢将sectionnr发送为1-n,所以我只是从sectionnr.中减去1。