Table.ReplaceValue
语法
Table.ReplaceValue(table as table, oldValue as any, newValue as any, replacer as function, columnsToSearch as list) as table
关于
在 table
的指定列中将 oldValue
替换为 newValue
。
示例 1
在表中将文本“goodbye”替换为文本“world”。
使用情况
Table.ReplaceValue( Table.FromRecords({ [a = 1, b = "hello"], [a = 3, b = "goodbye"] }), "goodbye", "world", Replacer.ReplaceText, { "b" })
输出
Table.FromRecords({ [a = 1, b = "hello"], [a = 3, b = "world"] })
示例 2
在表中将文本“ur”替换为文本“or”。
使用情况
Table.ReplaceValue( Table.FromRecords({ [a = 1, b = "hello"], [a = 3, b = "wurld"] }), "ur", "or", Replacer.ReplaceText, { "b" })
输出
Table.FromRecords({ [a = 1, b = "hello"], [a = 3, b = "world"] })