修剪和REReplace [英] trim and REReplace

查看:139
本文介绍了修剪和REReplace的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有这个号码:00000000010000000099B我需要在10和99之前删除0和99之后的字母像B.我还需要替换10之间的0和99 - - 。我不知道如何在这个字符串中使用trim和Rereplace这两个数字。任何的想法?我很感激。谢谢

Hi,

I have this number: 00000000010000000099B I need to remove the 0s before 10 and 99 and the alphabets like B after 99. I also need to replace the 0s between 10 and 99 by "-". I don''t know how to use trim and Rereplace for these two numbers in this string. Any Idea? I appreciate it. Thanks

推荐答案

这些字符串的模式是什么?


更换0和B很简单,但是10会使它更难,因为它有一个0!
What''s the pattern of these strings?

Replacing 0 and B is easy, but the 10 would make it more difficult because it has a 0!


同意。我也有这个问题。模式为:字符串开头的10位数(第1个数字)+ 2个数字后的数字(2个数字)+ 1个字母。


我认为我们应该从字符串的开头清除4或5个第一个数字(0)然后留下接下来的5个数字然后插入我们的 - 并再次清理4或5下一个0并离开其余部分并再次清洁字母表。您怎么看?
Agree. I have this problem too. The pattern is : 10 digits at the beginning of the string (for the 1st number) + 10 more digits after (for the 2ed number) + 1 alphabet.

I think we should clean the 4 or 5 first digits (0s) from the beginning of the string then leave the next 5 digits then insert our "-" and again clean the 4 or 5 next 0s and leave the rest and again clean the alphabet. What do you think?


这确实使问题更容易,因为您有一致的模式。


但是,我注意到在示例字符串中你有9 0然后是10.这是正确的还是应该是8 0然后是10?
That does make the problem easier because you have a consistent pattern.

However, I notice that in the example string you have 9 0s then 10. Is that correct or should it be 8 0s then a 10?


这篇关于修剪和REReplace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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