英文:
Power Query, Remove 1st 2 characters in string
问题
我有一列电话号码,由于代理人输入它们到数据库的方式不同,格式稍有不同。有些以0
开头,有些以44
(国家代码)开头。我找到了一个在线代码,帮助我删除字符串开头的0
,但现在我尝试修改它以删除字符串开头的44
,但出现了一些问题。
= Table.TransformColumns(
#"Renamed Columns",
{{
"telephone",
each if Text.Start(Text.From(_),2)="44"
then
""&Text.From(_)
else _
}})
提前感谢您的任何帮助。
英文:
I have a column of telephone numbers in slightly different formats due to how the agents input them into the database. Some start with a 0
and some with 44
(country code). I have found a code online that has helped me remove the 0's at the start of the string but now I am trying to adapt this to remove the 44
at the beginning of the string and for some reason, it doesn't seem to want to play ball.
= Table.TransformColumns(
#"Renamed Columns",
{{
"telephone",
each if Text.Start(Text.From(_),2)="44"
then
""&Text.From(_)
else _
}})
Thanks in advance for any assistance
答案1
得分: 2
Table.TransformColumns(#"Changed Type",{{"telephone",每个如果Text.Start(Text.From(),2)="44"则Text.RemoveRange(Text.From(),0,2)否则_ }})
英文:
This should work
Table.TransformColumns(#"Changed Type",{{"telephone",each if Text.Start(Text.From(_),2)="44" then Text.RemoveRange(Text.From(_),0,2) else _ }})
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论