Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Replace Values in a List found after Delimiter

I am stuck with a problem where i am trying to replace List values found after a specific delimiter say"~" with blank.

 

= List.ReplaceValue(Custom1, each Text.AfterDelimiter(_, "~"), "" , Replacer.ReplaceText)

where Custom1 is my list which looks like this:

List

%ROI~Latest 4 Wks - W/E 08/31/19
$Amt~Latest 4 Wks - W/E 08/31/19
CUnits~Latest 4 Wks - W/E 08/31/19

 

 

I want the list to like below, stripping the text properly (including the "~" sign).

List

%ROI
$Amt
CUnits

 

But i get the same List back, which means it is either not able to find each value in list or something else is missing!

List

%ROI~Latest 4 Wks - W/E 08/31/19
$Amt~Latest 4 Wks - W/E 08/31/19
CUnits~Latest 4 Wks - W/E 08/31/19

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Ok, i found the simple solution myself using List.Transform. :-)

    = List.Transform(Custom1, each Text.BeforeDelimiter(_, "~"))

    List

    %ROI
    $Amt
    CUnits

     

    Hope this helps!

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Ok, i found the simple solution myself using List.Transform. :-)

    = List.Transform(Custom1, each Text.BeforeDelimiter(_, "~"))

    List

    %ROI
    $Amt
    CUnits

     

    Hope this helps!