42、Power Query-Text.Remove函数应用
本节我们学习函数:Text.Remove
Removes all occurrences of a character or list of characters from a text value. The removeChars parameter can be a character value or a list of character values.
用法: Text.Remove(text as nullable text, removeChars as any) as nullable text| text | The text to parse. |
| removeChars | A character value or a list of character values to be removed. |
例如:Text.Remove("111122223333abcdefg","1") 从字符串中去掉字符“1”。
又例如:Text.Remove("11112233abcdefg4445554hg66fd6",{"1".."9"}) 从字符串中去掉字符“1”~“9”。
再例如:Text.Remove("11A1我12是C233a中bBcde国fg44H4人5554hg66fd6",{"1".."9","a".."z","A".."Z"}) 从字符串中提取汉子。
附加:汉字范围:“一”..“龥” (按住Alt+64923)。
下面我们看一个小例子:
根据上图中的中英文名字,分别显示每个人的中文名和英文名。
用上面的Text.Remove函数简直易如反掌。
首先得到中文名:Text.Remove([中英文名],{"a".."z","A".."Z"})
其次得到英文名:Text.Remove([中英文名],{"一".."龥"})
最后对两列进行修整即可。
最后每一次的更新都可以及时刷新。
总结
以上是生活随笔为你收集整理的42、Power Query-Text.Remove函数应用的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 41、Power Query-Text.
- 下一篇: 43、Power Query-函数综合应