Skip to content
Advertisement

Finding line and position of text in string

I need to get de line number and position (on that line) of a specific word in a text.

For example:

If I would check for ‘second’ I should get something back like: 2,12

Anyone any suggestion?

Advertisement

Answer

Assuming you are looking for the first occurrence per line, and assuming a LINE is delimited by char(13) and not punctuation.

Example

Returns

EDIT – Requested EDIT

Returns

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement