PowerQuery如何在字符串中首次下部案例字母后删除文本

发布于 2025-02-13 21:31:43 字数 1182 浏览 0 评论 0原文

我有一个数据表,其中包含具有以下格式的多个单元格:

Pro-Plas Africa Explastic Machinery&材料展览。 Pro-Plas Africa Expo具有塑料加工机械,冷水机,转换设备,挤出设备,饲养器,加工辅助设备,回收设备,各种材料,吹塑机械,

我想转换绳子以从第一个下部案例字母中删除所有内容,所以我剩下的:

Pro-Plas Africa Expop

然后删除字符串中的最后一封信离开:

Pro-Plas Africa Expo

我尝试使用以下内容:

'#"Added Custom" = Table.AddColumn(#"Changed Type", "allCaps", each 
        Text.Combine(
            List.Accumulate(Text.Split([Column1]," "),
                            {},
                            (state, current)=>  
                                if List.ContainsAny(
                                        Text.ToList(current),
                                            {"0".."9","a".."z",",",":","?","/","\"," "}) 
                                then state 
                                else state & {current}),", "))'

使用[Column1]代替相关表专栏,提供:

Pro-Plas Africa& Pro-Plas Africa Expo

我可以解决这是因为第一次出现“ Explastic”包含上层和下案字母。.

我也尝试了“ text.emove”以摆脱所有下部案例字母,但这留下了每个单词开始时的上案例:

Pro-Plas Africa Expop M& M E. Pro-Pro-Plas Africa Expo P,C,C,C,E,F,P,RV,B

最初的下部案例字母在每个细胞中处于不同的位置。

有解决方案吗?

I have a table of data which contains multiple cells with the following format:

PRO-PLAS AFRICA EXPOPlastic Machinery & Materials Exhibition. PRO-PLAS AFRICA EXPO features Plastics processing machinery, Chillers, Converting equipment, Extrusion equipment, Feeders, Processing aids, Recycling equipment, Various materials, Blow moulding machinery

I want to transform the string to remove everything from the first lower case letter, so I am left with:

PRO-PLAS AFRICA EXPOP

Then remove the last letter in the string to leave:

PRO-PLAS AFRICA EXPO

I have tried using the following:

'#"Added Custom" = Table.AddColumn(#"Changed Type", "allCaps", each 
        Text.Combine(
            List.Accumulate(Text.Split([Column1]," "),
                            {},
                            (state, current)=>  
                                if List.ContainsAny(
                                        Text.ToList(current),
                                            {"0".."9","a".."z",",",":","?","/","\"," "}) 
                                then state 
                                else state & {current}),", "))'

with [column1] substituted for the relevant table column, which delivers:

PRO-PLAS AFRICA & PRO-PLAS AFRICA EXPO

I can work out that this is because the first occurrence of "EXPOPlastic" contains upper and lower case letters..

I have also tried "text.remove" to get rid of all lower case letters, but this leaves the upper case at the start of each word giving:

PRO-PLAS AFRICA EXPOP M & M E. PRO-PLAS AFRICA EXPO P, C, C, E, F, P, R V , B

The initial lower case letter is in a different position in each cell.

is there a solution to this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倦话 2025-02-20 21:31:43

尝试

= Table.AddColumn(#"Changed Type", "Custom", each Text.Start([Column1],Text.PositionOfAny([Column1],{"a".."z"})-1))

Try

= Table.AddColumn(#"Changed Type", "Custom", each Text.Start([Column1],Text.PositionOfAny([Column1],{"a".."z"})-1))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文