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-函数综合应