Xref: utzoo comp.lang.c:30409 comp.lang.c++:8535 Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!bloom-beacon!eru!luth!sunic!mcsun!ukc!warwick!cuuee From: cuuee@warwick.ac.uk (Sean Legassick) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Parsing lists containing numeric ranges Message-ID: <1990Jul19.145033.7380@warwick.ac.uk> Date: 19 Jul 90 14:50:33 GMT Sender: news@warwick.ac.uk (Network news) Organization: Computing Services, University of Warwick, UK Lines: 20 Does anyone know of a C routine that will expand strings containing numbers and ranges into a list of strings, or will give you the numbers one at a time. e.g. A function 'expand_range(char *string, char *buffer);' which on being given a pointer to the string "1,3-6,9-11,15" would place in buffer the string "1,3,4,5,6,9,10,11,15" (perhaps also having an integer argument for size of buffer so that a spurious '9-9999' didn't corrupt all data memory!) or Two functions, 'int expand_range_start(char *str);' and 'int expand_range_next(char *str);' which would return the expanded list of numbers one at a time. ------------------------------------------------------------------------ SSSSSSS K K L Sean Legassick, S K K L "Allow me to introduce SSSSSSS KK L CU, University myself: I am the main S K K L of Warwick dish of the day." SSSSSSS K K LLLLLLL (D Adams)