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: Jul 17 2021
Copyright © 2021 Thunderstone Software LLC. All rights reserved.