How Icon positions are numbered |
|
In Icon, the characters in a string are identified by their
position, counting from 1. The positions refer to the
gaps between the characters, not to the characters themselves.
Positive numbers count from the left starting at 1, and nonpositive
numbers count from the right starting at 0. For
example, the positions of the gaps in the string "abc"
are numbered like this:
-3 -2 -1 0
+-----+-----+-----+
| a | b | c |
+-----+-----+-----+
1 2 3 4
So position 1 (or -3) refers to the position before the first character;
position 2 (or -2) refers to the position before the second character;
and so on. Position 0 is always the end of the string.
|
John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:12:57 UT URL: http://www.nmt.edu/tcc/help/lang/icon/positions.html |
|