Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Text.PositionOfAny

I'm using the text function "Text.PositionOfAny([Assistência], {"S"}, Occurrence.All)" to get the sequence of S from a string field.   This is the string field "NNNNNNNNNSNNSNNNNNNNNNNNNNNNNNNNNNN...
  • Ashish_Mathur's avatar
    3 years ago

    Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Added Custom" = Table.AddColumn(Source, "Custom", each List.Transform(Text.PositionOf([Text], "S", Occurrence.All), each Number.From(_) + 1)),
        #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), "-"), type text})
    in
        #"Extracted Values"

    Hope this helps.