Textfield cursor position

Hi everyone

Is there a built in function that can get the current cursor position within a text field? I.e. returns an index position?

Thanks for reading.

regards,
Mike