Function

GLib-2.0GLibutf8_pointer_to_offset

  • Converts from a pointer to position within a string to an integer character offset.

    Since 2.10, this function allows pos to be before str, and returns a negative offset in this case.

    Parameters

    • str: string

      a UTF-8 encoded string

    • pos: string

      a pointer to a position within str

    Returns number

    the resulting character offset