标题: 求助:perl格式化数组 [打印本页] 作者: 815138698 时间: 2015-07-28 19:05 标题: 求助:perl格式化数组 Write a function, format_number_list, whose argument is a list of integers. It then returns a string which represents the input list in compact, human-readable form.
For example,
format_number_list (1, 2, 4, 5, 6, 7, 9, 13, 24, 25, 26, 27)
will return
"1-2, 4-7, 9, 13, 24-27"
Also write a function, 'expand_number_list', which does the conversion in the opposite direction, so that
expand_number_list("1-2, 4-7, 9, 13, 24-27")
will return
(1, 2, 4, 5, 6, 7, 9, 13, 24, 25, 26, 27) 作者: MMMIX 时间: 2015-07-28 20:24
题目不错呀作者: rubyish 时间: 2015-07-29 01:03
biru: