Updated functions

This commit is contained in:
2025-10-24 14:22:52 +03:00
parent 2418f93b72
commit 41c665985b
4 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
( sInputText as nullable text,
optional bWholeCell as nullable logical,
optional sTag as nullable text,
optional tSubstitution as nullable table) as text =>
let
bIsWholeCell = if (bWholeCell = null) then true else bWholeCell,
bIsTagged = not (sTag = null),
tSubstitution = if tSubstitution = null then
if bIsTagged then
try Table.SelectRows(fP("RENAMING_RULES"), each ([#"#"] = sTag)) otherwise fP("RENAMING_RULES")
else
fP("RENAMING_RULES")
else
tSubstitution,
tSubstBuffer = Table.Buffer(tSubstitution),
ReplacedText = List.Accumulate(Table.ToRows(tSubstBuffer), sInputText, (state, substitution) =>
if bIsWholeCell then
if (state = substitution{0}) then
substitution{1}
else
state
else
Text.Replace(state, substitution{0}, substitution{1}))
in
ReplacedText