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!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |