refInfoGetTextOffset

SYNOPSIS

int64 refInfoGetTextOffset(refInfo ref)

Parameters:

  • ref - A refInfo object

Returns:

  • The int64 character offset of the reference's element in the formatted text


DESCRIPTION
The refInfoGetTextOffset function returns the int64 character (not byte) offset of the reference's element in the formatted text (here). The offset is the number of characters from the start of the text to the start of the reference.


EXAMPLE

<urlinfo text><$text = $ret>
  <$offset = (refInfoGetTextOffset($ref))>
  <$length = (refInfoGetTextLength($ref))>
  <substr $text $offset $length>
  Reference's text: $ret


CAVEATS
Note that the returned offset is in characters, not bytes. Thus the length is typically correct for use with <substr> (with default stringcomparemode) on <urlinfo text>, which is UTF-8 by default.

The offset may be -1 (unavailable) in some instances, e.g. if the reference was generated by JavaScript.


SEE ALSO
refInfoGetProcessedDocOffset


Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.