Skip to main content


Returns the FIELD substring end position.




The COL2 function takes no arguments. The parentheses are mandatory.


The COL2 function returns the ending position for the most recently called FIELD function. FIELD extracts a substring from a string by specifying a delimiter character. This substring is limited by encountering the next delimiter character. COL2 returns the string position (counting from 1) of this substring-ending delimiter character.

If the FIELD delimiter is not located in string and count=1, COL2 returns the full length of string. If FIELD returns a null string, COL2 returns 0.

The initial COL2 value is 0. The COL2 value is preserved until it is overwritten by the next FIELD function call.

COL2 returns a substring's end delimiter position. COL1 returns a substring's start delimiter position.


The following example shows the use of the COL2 function:

FOR x=1 TO 5
   PRINT FIELD(colors,"^",x)
   PRINT "End delimiter position: ":COL2()
      ! Returns: 4, 10, 15, 22, 29

See Also

FeedbackOpens in a new tab