NotAtEnd (StringTokenizer function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (link repair)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Template:StringTokenizer:NotAtEnd subtitle}}
{{Template:StringTokenizer:NotAtEnd subtitle}}


This method returns a Boolean value that is <code>true</code> if
This method returns a <var>[[Boolean enumeration]]</var> value that is <code>true</code> if
any tokens remain starting from <var>[[NextPosition (StringTokenizer property)|NextPosition]]</var>.
any tokens remain starting from <var>[[NextPosition (StringTokenizer property)|NextPosition]]</var>.


Line 11: Line 11:
<tr><th>%boolean</th>
<tr><th>%boolean</th>
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>NotAtEnd</var>. The result is <code>true</code> if any tokens remain, starting from <var>NextPosition</var>, and <code>false</code> if no tokens remain.
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>NotAtEnd</var>. The result is <code>true</code> if any tokens remain, starting from <var>NextPosition</var>, and <code>false</code> if no tokens remain.
For more information about <var>Boolean</var> enumerations, see [[Enumerations#Using_Boolean_enumerations|"Using Boolean Enumerations"]]. </td></tr>


<tr><th>stringTokenizer</th>
<tr><th>stringTokenizer</th>
Line 21: Line 19:
<ul>
<ul>
<li>It is illegal to scan for a token past the <var>CurrentToken</var> if <var>NotAtEnd</var> is <code>false</code>.
<li>It is illegal to scan for a token past the <var>CurrentToken</var> if <var>NotAtEnd</var> is <code>false</code>.
<li>For <var>Spaces</var> tokenization, a token remains if there are any non-<var>Spaces</var> characters remaining at or
<li>For <var>[[Spaces (StringTokenizer property)|Spaces]]</var> tokenization, a token remains if there are any non-<var>Spaces</var> characters remaining at or
after <var>NextPosition</var>.
after <var>NextPosition</var>.
   
   
<li>For <var>Separators</var> tokenization, a token remains if either:
<li>For <var>[[Separators (StringTokenizer property)|Separators]]</var> tokenization, a token remains if either:
 
<ul>
<ul>
<li><var>NextPosition</var> is less than or equal to the length of the <var>String</var>.
<li><var>NextPosition</var> is less than or equal to the length of the <var>String</var>.
Line 30: Line 29:
the last method which located a token found a separator at the end of the <var>String</var>.
the last method which located a token found a separator at the end of the <var>String</var>.
</ul>
</ul>
<li> <var>NextTokenPositin</var> may be after the last token but
 
<li> <var>NextPosition</var> may be after the last token but
not necessarily at the end of the token string.
not necessarily at the end of the token string.
In the following code sequence, the return from <var>NotAtEnd</var> is <code>false</code>
In the following code sequence, the return from <var>NotAtEnd</var> is <code>false</code>
Line 36: Line 36:
<p class="code">%tok = 'example  ':stringTokenizer
<p class="code">%tok = 'example  ':stringTokenizer
%tok:nextPosition = 8
%tok:nextPosition = 8
printText {~=%tok:notAtEnd}
[[Targeted Text statements#AuditText, PrintText, and TraceText|printText]] {~=%tok:notAtEnd}
</p>
</p>



Latest revision as of 21:22, 17 December 2014

Is present tokenizing position at end of tokenizerstring? (StringTokenizer class)


This method returns a Boolean enumeration value that is true if any tokens remain starting from NextPosition.

Syntax

%boolean = stringTokenizer:NotAtEnd

Syntax terms

%boolean An enumeration object of type Boolean to contain the returned value of NotAtEnd. The result is true if any tokens remain, starting from NextPosition, and false if no tokens remain.
stringTokenizer A StringTokenizer object expression.

Usage notes

  • It is illegal to scan for a token past the CurrentToken if NotAtEnd is false.
  • For Spaces tokenization, a token remains if there are any non-Spaces characters remaining at or after NextPosition.
  • For Separators tokenization, a token remains if either:
    • NextPosition is less than or equal to the length of the String.
    • Either a token has not been located in the String, or the last method which located a token found a separator at the end of the String.
  • NextPosition may be after the last token but not necessarily at the end of the token string. In the following code sequence, the return from NotAtEnd is false and the position is not at the end of the string:

    %tok = 'example ':stringTokenizer %tok:nextPosition = 8 printText {~=%tok:notAtEnd}

  • AtEnd is the reverse of NotAtEnd: it returns a false value if the current tokenizing position is not at the end of the string.

See also