在最后(或第四次)出现“。”时分割字符串。定界符 [英] Split string at last (or fourth) occurence of "." delimiter

查看:82
本文介绍了在最后(或第四次)出现“。”时分割字符串。定界符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按如下所示分隔字符串

I like to delimit the string as follow

给出以下字符串:

Column 1    
10.80.111.199.1345
127.0.0.1.3279

我想在最后一个。之后定界数字,这将得到以下输出结果

I will like to delimit numbers after the last ".", which will get the follow output

 Column 1       Column 2               

10.1.12.5       1345
127.0.0.1       3279

我知道excel具有定界符功能,该函数使我可以使用特定符号或通过固定宽度定界。

I know excel has the delimitor function which allows me to delimit with specific symbol or through the fixed width. It does not seems to work for fixed width.

有没有其他选择,而不是用。分隔。可以将列1的字符串缩进去?

Is there any alternatives, rather than delimited with "." can concating back the strings on Column 1?

推荐答案

如果所有值都遵循您描述的相同格式,则可以使用这些公式:

If all of your values follow the same format you have described then you could use these formulas:

= LEFT(A1,LEN(A1)-5)将 127.0.0.1

=LEFT(A1,LEN(A1)-5) returms "127.0.0.1"

= RIGHT(A1,4)返回 3279

否则,如果需要更动态,那么这些公式将起作用(参考: Excel:字符串中的最后一个字符/字符串匹配

Otherwise, if it needs to be more dynamic then these formulas will work (Reference: Excel: last character/string match in a string)

= LEFT(A1,FIND( @,SUBSTITUTE(A1,。, @,LEN (A1)-LEN(SUBSTITUTE(A1,。,))))-1)

反义词 127.0.0.1

returms "127.0.0.1"

= TRIM(RIGHT(SUBSTITUTE(A1,。,REPT(,99)),99))

返回 3279

这篇关于在最后(或第四次)出现“。”时分割字符串。定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆