使用PERL扩展十六进制数字范围 [英] Expand a Hex number range with PERL

查看:109
本文介绍了使用PERL扩展十六进制数字范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


是否可以扩展十六进制数范围?


这是我在文本文件中的内容.. 。


002A:002F

03E0:03E0

03E2:03E2

07AF:07B1

0212:0212

0248:0248


我想扩大范围(当有范围时)并且全部包括领先的0'。


这是我要找的输出......


002A

002B

002C

002D

002E

002F

03E0

03E2

07AF

07B0

07B1

0212

0248


我找到的所有信息都是转换十六进制数字....任何帮助都将不胜感激。


谢谢,Fil

Hi There,

Is it possible to expand Hex number range?

Here is what I have in a text file...

002A:002F
03E0:03E0
03E2:03E2
07AF:07B1
0212:0212
0248:0248

I would like to expand the range (when there is a range) and have all including the leading 0''s.

Here is the output I am looking for...

002A
002B
002C
002D
002E
002F
03E0
03E2
07AF
07B0
07B1
0212
0248

All the information I found was to convert a Hex number.... any help would be appreciated.

Thanks, Fil

推荐答案

为什么不使用:分割每个范围?作为分隔符并将每个元素放入一个数组中。然后,对数组进行排序并打印出来。只是一个想法。尝试这样做,如果你遇到困难,请在这里粘贴你的代码。


问候,


杰夫
why not split each range using the ":" as the delimiter and put each element into an array. Then, sort the array and print it. Just an idea. Try to do it, then if you get stuck, paste your code here.

Regards,

Jeff

今天打电话给我慷慨,但我把它快速地扔到了一起并根据你提供的样本进行了测试。它应该适合你:

Call me generous today, but I threw this together quickly and tested it against the sample you provided. It should work for you:

展开 | 选择 | Wrap | 行号


WOW ......太棒了..谢谢你的号码。 。


它完全符合我的需要并保持数字格式(所有前导零)...

感谢你的时间..JFC
WOW... that is fantastic.. Thank you numberwhun..

It does exactly what I need plus keeps the number format (all leading zeros)...
Appreciate your time..JFC


这篇关于使用PERL扩展十六进制数字范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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