refInfoGetTextLength

SYNOPSIS

int64 refInfoGetTextLength(refInfo ref)

Parameters:

  • ref - A refInfo object

Returns:

  • The int64 character length of the reference's formatted text span.


DESCRIPTION
The refInfoGetTextLength function returns the int64 character (not byte) length of the reference's element in the formatted text (here). The length will generally span from the opening tag through the closing tag (if any).


EXAMPLE

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


CAVEATS
Note that the returned length 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.

Note that the formatted text length may not be the same as the length of refInfoGetLinkText (here), as the latter is the clickable text, whereas refInfoGetTextLength returns the span of the entire element. E.g. for forms, the link text is empty, whereas the text length includes any formatted text from within the form. The length may be -1 (unavailable) in some instances, e.g. if the reference was generated by JavaScript.


SEE ALSO
refInfoGetProcessedDocLength


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.