Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need a code that given a byte offset in a multiline string, will return a line number and offset inside that string (e.g. imagine that a string contains entire content of some text file). The byte offset will be advancing on each call, so it may perform some smart optimizations.. Size of input string won't be greater than 200kb.
I can code such a beast in half of an hour, but may be some modules exist on CPAN for this?
Thank you for your answer in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find line number and offset inside line given a byte offset in string
by Limbic~Region (Chancellor) on Nov 28, 2005 at 14:29 UTC | |
|
Re: Find line number and offset inside line given a byte offset in string
by Zaxo (Archbishop) on Nov 28, 2005 at 15:54 UTC | |
|
Re: Find line number and offset inside line given a byte offset in string
by QM (Parson) on Nov 28, 2005 at 16:34 UTC |